kongdeqiang
2024-04-22 7bc78d8f70a4d11e46f8bd640228804a3dd0dc68
src/main/java/com/boying/controller/TicketBlackController.java
@@ -11,6 +11,8 @@
import com.boying.util.FileUtil;
import com.boying.util.NumberToCN;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
@@ -32,6 +34,7 @@
@RestController
@RequestMapping("ffzf/ticketblack")
@RequiredArgsConstructor
@Tag(description = "ffzf/ticketblack" , name = "黑名单表接口" )
public class TicketBlackController {
@@ -43,16 +46,18 @@
    @PostMapping("findPage")
    @Operation(summary = "分页查询" , description = "分页查询" )
    public Object findPage(Page page, TicketBlack ticket){
        QueryWrapper<TicketBlack> wrapper =  new QueryWrapper<>();
        wrapper.lambda()
                .eq(StringUtils.isNotBlank(ticket.getCarNo()),TicketBlack::getCarNo,ticket.getCarNo())
                .like(StringUtils.isNotBlank(ticket.getCarNo()),TicketBlack::getCarNo,ticket.getCarNo())
                .eq(ticket.getIsActive() != null,TicketBlack::getIsActive,ticket.getIsActive())
                .orderByDesc(TicketBlack::getCreateTime);
        return R.ok(ticketBlackService.page(page, wrapper));
    }
    @PostMapping("/save")
    @Operation(summary = "新增黑名单" , description = "新增黑名单" )
    public Object save(TicketBlack ticket) throws IOException{
        QueryWrapper<TicketBlack> wrapper = new QueryWrapper<>();
        wrapper.lambda()
@@ -74,6 +79,7 @@
     */
    @ApiOperation(value = "通过id查询", notes = "通过id查询")
    @GetMapping("/{id}" )
    @Operation(summary = "通过id查询" , description = "通过id查询" )
    public R getById(@PathVariable("id" ) Integer id) {
        TicketBlack byId = ticketBlackService.getById(id);
        return R.ok(byId);
@@ -81,13 +87,21 @@
    @PostMapping("/delete")
    @Operation(summary = "删除黑名单" , description = "删除黑名单" )
    public Object delete(Long id){
        TicketBlack ticket =ticketBlackService.getById(id);
        ticketBlackService.saveOrUpdate(ticket);
        return R.ok("操作成功");
        if(ticket!=null){
            if(ticket.getViolationCount() >0 ){
                return R.failed("请先解决违章");
            }
            ticketBlackService.removeById(ticket);
            return R.ok("操作成功");
        }
        return R.failed("未找到该车");
    }
    @PostMapping("/updateById")
    @Operation(summary = "更新黑名单" , description = "更新黑名单" )
    public Object updateById(TicketBlack ticket){
        return R.ok( ticketBlackService.updateById(ticket));
    }