| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ycl.annotation.LogSave; |
| | | import com.ycl.api.CommonResult; |
| | | import com.ycl.controller.BaseController; |
| | | import com.ycl.dto.carManage.CarEnforcecarVo; |
| | | import com.ycl.entity.carManage.CarEnforcecar; |
| | | import com.ycl.entity.carManage.CarSlagcar; |
| | | import com.ycl.enums.common.ResultCode; |
| | | import com.ycl.exception.ApiException; |
| | | import com.ycl.service.carManage.ICarEnforcecarService; |
| | | import com.ycl.service.carManage.ICarSlagcarService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @ApiOperation(value = "查询执法车") |
| | | @GetMapping("/query_enforce") |
| | | public CommonResult searchEnforceCar(@RequestParam(required = false) String carNum, |
| | | @RequestParam Integer size, |
| | | @RequestParam Integer current) { |
| | | Page<CarEnforcecar> carEnforcecarPage = new Page<>(); |
| | | carEnforcecarPage.setSize(size); |
| | | carEnforcecarPage.setCurrent(current); |
| | | return CommonResult.success(iCarEnforcecarService |
| | | .page(carEnforcecarPage, new LambdaQueryWrapper<CarEnforcecar>() |
| | | .like(StringUtils.isNotBlank(carNum), CarEnforcecar::getCarNumber, carNum))); |
| | | public CommonResult<Page<CarEnforcecarVo>> searchEnforceCar(@RequestParam(required = false) String carNum, |
| | | @RequestParam Integer size, |
| | | @RequestParam Integer current) { |
| | | Page<CarEnforcecarVo> page = iCarEnforcecarService.searchEnforceCar(size, current, carNum); |
| | | return CommonResult.success(page); |
| | | } |
| | | |
| | | @ApiOperation(value = "查询渣土车") |
| | |
| | | |
| | | @ApiOperation("添加执法车") |
| | | @PostMapping("/addition_enforce") |
| | | @LogSave(operationType = "车俩管理", contain = "添加执法车") |
| | | public CommonResult addEnforceCar(@RequestBody CarEnforcecar carEnforcecar) { |
| | | CarEnforcecar enforceCar = iCarEnforcecarService |
| | | .getOne(new LambdaQueryWrapper<CarEnforcecar>() |
| | | .eq(CarEnforcecar::getCarNumber, carEnforcecar.getCarNumber())); |
| | | if (enforceCar != null && StringUtils.isNotBlank(enforceCar.getCarNumber())) { |
| | | throw new ApiException(ResultCode.CAR_NUMBER_REPETITION.getMessage()); |
| | | } |
| | | return CommonResult.success(iCarEnforcecarService.save(carEnforcecar)); |
| | | } |
| | | |
| | | @ApiOperation("添加渣土车") |
| | | @PostMapping("/addition_slag") |
| | | @LogSave(operationType = "车俩管理", contain = "添加渣土车") |
| | | public CommonResult addSlagCar(@RequestBody CarSlagcar carSlagcar) { |
| | | CarSlagcar slagCar = iCarSlagcarService |
| | | .getOne(new LambdaQueryWrapper<CarSlagcar>() |
| | | .eq(CarSlagcar::getCarNumber, carSlagcar.getCarNumber())); |
| | | if (slagCar != null && StringUtils.isNotBlank(slagCar.getCarNumber())) { |
| | | throw new ApiException(ResultCode.CAR_NUMBER_REPETITION.getMessage()); |
| | | } |
| | | return CommonResult.success(iCarSlagcarService.save(carSlagcar)); |
| | | } |
| | | |
| | | @ApiOperation("删除执法车") |
| | | @DeleteMapping("/deletion_enforce") |
| | | @LogSave(operationType = "车俩管理", contain = "删除执法车") |
| | | public CommonResult deleteEnforceCar(@RequestParam Integer id) { |
| | | return CommonResult.success(iCarEnforcecarService.removeById(id)); |
| | | } |
| | | |
| | | @ApiOperation("删除渣土车") |
| | | @DeleteMapping("/deletion_slag") |
| | | @LogSave(operationType = "车俩管理", contain = "删除渣土车") |
| | | public CommonResult deleteSlagCar(@RequestParam Integer id) { |
| | | return CommonResult.success(iCarSlagcarService.removeById(id)); |
| | | } |
| | | |
| | | @ApiOperation("批量删除执法车") |
| | | @DeleteMapping("/batch_deletion_enforce") |
| | | @LogSave(operationType = "车辆管理", contain = "批量删除执法车") |
| | | public CommonResult batchDeleteEnforce(@RequestParam List<Long> ids) { |
| | | return CommonResult.success(iCarEnforcecarService.removeBatchByIds(ids)); |
| | | } |
| | | |
| | | @ApiOperation("批量删除渣土车") |
| | | @DeleteMapping("/batch_deletion_slag") |
| | | @LogSave(operationType = "车辆管理", contain = "批量删除渣土车") |
| | | public CommonResult batchDeleteSlag(@RequestParam List<Long> ids) { |
| | | return CommonResult.success(iCarSlagcarService.removeBatchByIds(ids)); |
| | | } |
| | | } |