This commit is contained in:
Vinjor 2024-11-06 18:23:52 +08:00
parent ffbf0130d6
commit a9f2a8f967
3 changed files with 39 additions and 12 deletions

View File

@ -24,6 +24,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -107,6 +108,8 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
@Override @Override
public CommonResult<String> updateCarMain(CarMainReqVO updateReqVO) { public CommonResult<String> updateCarMain(CarMainReqVO updateReqVO) {
//车牌号license_number车架号vin发动机号码engine_number 重复校验 //车牌号license_number车架号vin发动机号码engine_number 重复校验
if(StringUtils.isEmpty(updateReqVO.getId())){
//没有车辆id才需要查重
int checkResult = isDataKeyValueRepeat(updateReqVO); int checkResult = isDataKeyValueRepeat(updateReqVO);
//如果查重失败 //如果查重失败
if (checkResult != 0) { if (checkResult != 0) {
@ -120,6 +123,7 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
} }
} }
}
//车俩品牌型号级联选择器返回值第一位是品牌第二位是型号 //车俩品牌型号级联选择器返回值第一位是品牌第二位是型号
List<String> brandAndModel = updateReqVO.getBrandAndModel(); List<String> brandAndModel = updateReqVO.getBrandAndModel();
// 插入 // 插入

View File

@ -1,17 +1,25 @@
package cn.iocoder.yudao.module.booking.controller.admin; 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.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.booking.entity.DlRepairBooking; import cn.iocoder.yudao.module.booking.entity.DlRepairBooking;
import cn.iocoder.yudao.module.booking.service.DlRepairBookingService; import cn.iocoder.yudao.module.booking.service.DlRepairBookingService;
import cn.iocoder.yudao.module.booking.vo.DlRepairBookingReqVO; import cn.iocoder.yudao.module.booking.vo.DlRepairBookingReqVO;
import cn.iocoder.yudao.module.booking.vo.DlRepairBookingRespVO; 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.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; 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; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/** /**
@ -28,6 +36,9 @@ public class DlRepairBookingController {
*/ */
@Resource @Resource
private DlRepairBookingService dlRepairBookingService; private DlRepairBookingService dlRepairBookingService;
@Resource
private DictDataApi dictDataApi;
/** /**
* 维修预约表 新增修改 * 维修预约表 新增修改
@ -92,9 +103,20 @@ public class DlRepairBookingController {
@GetMapping("/list") @GetMapping("/list")
@Operation(summary = "维修预约表 不分页") @Operation(summary = "维修预约表 不分页")
public CommonResult<?> getBookingList(@RequestParam("userId")Integer userId){ public CommonResult<?> getBookingList(@RequestParam("userId")Integer userId){
return success(dlRepairBookingService.list(new LambdaQueryWrapper<DlRepairBooking>() //维修项目类型字典
List<DictDataRespDTO> repairTypeList = dictDataApi.getDictDataList(DICT_REPAIR_TYPE);
Map<String,String> repairTypeMap = repairTypeList.stream().collect(Collectors.toMap(DictDataRespDTO::getValue,DictDataRespDTO::getLabel));
List<DlRepairBooking> respVOList = dlRepairBookingService.list(new LambdaQueryWrapper<DlRepairBooking>()
.eq(DlRepairBooking::getUserId,userId) .eq(DlRepairBooking::getUserId,userId)
.orderByDesc(DlRepairBooking::getBookingTime))); .orderByDesc(DlRepairBooking::getBookingTime));
List<DlRepairBookingRespVO> 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);
} }
} }

View File

@ -11,4 +11,5 @@ import lombok.Data;
**/ **/
@Data @Data
public class DlRepairBookingRespVO extends DlRepairBooking { public class DlRepairBookingRespVO extends DlRepairBooking {
private String repairText;
} }