diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CarMainServiceImpl.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CarMainServiceImpl.java index 2585ae24..e0b3901d 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CarMainServiceImpl.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CarMainServiceImpl.java @@ -24,6 +24,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -107,17 +108,20 @@ public class CarMainServiceImpl extends ServiceImpl impl @Override public CommonResult updateCarMain(CarMainReqVO updateReqVO) { //车牌号license_number,车架号vin,发动机号码engine_number 重复校验 - int checkResult = isDataKeyValueRepeat(updateReqVO); - //如果查重失败 - if (checkResult != 0) { - switch (checkResult) { - case 1: - return CommonResult.error(4051, "该车牌号已在系统中登记"); - case 2: - return CommonResult.error(4052, "该车架号已在系统中登记"); - case 3: - return CommonResult.error(4053, "该发动机号码已在系统中登记"); + if(StringUtils.isEmpty(updateReqVO.getId())){ + //没有车辆id才需要查重 + int checkResult = isDataKeyValueRepeat(updateReqVO); + //如果查重失败 + if (checkResult != 0) { + switch (checkResult) { + case 1: + return CommonResult.error(4051, "该车牌号已在系统中登记"); + case 2: + return CommonResult.error(4052, "该车架号已在系统中登记"); + case 3: + return CommonResult.error(4053, "该发动机号码已在系统中登记"); + } } } //车俩品牌型号级联选择器返回值,第一位是品牌,第二位是型号 diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/controller/admin/DlRepairBookingController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/controller/admin/DlRepairBookingController.java index bba5bfef..2d57cd29 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/controller/admin/DlRepairBookingController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/controller/admin/DlRepairBookingController.java @@ -1,17 +1,25 @@ package cn.iocoder.yudao.module.booking.controller.admin; +import cn.hutool.core.bean.BeanUtil; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.booking.entity.DlRepairBooking; import cn.iocoder.yudao.module.booking.service.DlRepairBookingService; import cn.iocoder.yudao.module.booking.vo.DlRepairBookingReqVO; import cn.iocoder.yudao.module.booking.vo.DlRepairBookingRespVO; +import cn.iocoder.yudao.module.system.api.dict.DictDataApi; +import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.v3.oas.annotations.Operation; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import static cn.iocoder.yudao.common.RepairCons.DICT_REPAIR_TYPE; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; /** @@ -28,6 +36,9 @@ public class DlRepairBookingController { */ @Resource private DlRepairBookingService dlRepairBookingService; + @Resource + private DictDataApi dictDataApi; + /** * 维修预约表 新增、修改 @@ -92,9 +103,20 @@ public class DlRepairBookingController { @GetMapping("/list") @Operation(summary = "维修预约表 不分页") public CommonResult getBookingList(@RequestParam("userId")Integer userId){ - return success(dlRepairBookingService.list(new LambdaQueryWrapper() + //维修项目类型字典 + List repairTypeList = dictDataApi.getDictDataList(DICT_REPAIR_TYPE); + Map repairTypeMap = repairTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel)); + List respVOList = dlRepairBookingService.list(new LambdaQueryWrapper() .eq(DlRepairBooking::getUserId,userId) - .orderByDesc(DlRepairBooking::getBookingTime))); + .orderByDesc(DlRepairBooking::getBookingTime)); + List rtnList = new ArrayList<>(); + for(DlRepairBooking booking:respVOList){ + DlRepairBookingRespVO newEntity = new DlRepairBookingRespVO(); + BeanUtil.copyProperties(booking,newEntity); + newEntity.setRepairText(repairTypeMap.get(newEntity.getRepairType())); + rtnList.add(newEntity); + } + return success(rtnList); } } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/vo/DlRepairBookingRespVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/vo/DlRepairBookingRespVO.java index 9390d110..e6edd45d 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/vo/DlRepairBookingRespVO.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/booking/vo/DlRepairBookingRespVO.java @@ -11,4 +11,5 @@ import lombok.Data; **/ @Data public class DlRepairBookingRespVO extends DlRepairBooking { + private String repairText; }