This commit is contained in:
PQZ 2024-08-07 19:53:08 +08:00
parent ca0cc34b3d
commit 7d54a42b35
5 changed files with 32 additions and 5 deletions

View File

@ -63,8 +63,13 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
}
}
//车俩品牌型号级联选择器返回值第一位是品牌第二位是型号
List<String> brandAndModel = createReqVO.getBrandAndModel();
// 插入
CarMain carMain = BeanUtils.toBean(createReqVO, CarMain.class);
carMain.setCarBrand(brandAndModel.get(0));
carMain.setCarModel(brandAndModel.get(1));
baseMapper.insert(carMain);
// 返回
return CommonResult.success("新增成功");
@ -88,9 +93,13 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
}
}
// 更新
CarMain updateObj = BeanUtils.toBean(updateReqVO, CarMain.class);
baseMapper.updateById(updateObj);
//车俩品牌型号级联选择器返回值第一位是品牌第二位是型号
List<String> brandAndModel = updateReqVO.getBrandAndModel();
// 插入
CarMain carMain = BeanUtils.toBean(updateReqVO, CarMain.class);
carMain.setCarBrand(brandAndModel.get(0));
carMain.setCarModel(brandAndModel.get(1));
baseMapper.updateById(carMain);
return CommonResult.success("修改成功");
}
@ -120,8 +129,12 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
public CarMainRespVO getCarMain(String id) {
//数据单查
CarMain carMain = baseMapper.selectById(id);
CarMainRespVO result = BeanUtils.toBean(carMain, CarMainRespVO.class);
List<String> brandAndModel = new ArrayList<>();
brandAndModel.add(carMain.getCarBrand());
brandAndModel.add(carMain.getCarModel());
CarMainRespVO result = BeanUtils.toBean(carMain, CarMainRespVO.class);
result.setBrandAndModel(brandAndModel);
//联查客户信息
List<CustomerMainRespVO> cusList = customerCarMapper.selectCusListByCarId(id);
result.setCusList(cusList);

View File

@ -85,4 +85,6 @@ public class CarMainReqVO extends PageParam {
@Schema(description = "车辆绑定标签信息")
List<BusiLabel> labelList;
/**车辆品牌型号数组*/
List<String> brandAndModel;
}

View File

@ -31,8 +31,15 @@ public class CarMainRespVO extends CarMain {
@Schema(description = "标签信息")
List<BusiLabel> labelList;
/**品牌字符*/
String brandStr;
/**型号字符*/
String modelStr;
/**车辆品牌型号数组*/
List<String> brandAndModel;

View File

@ -27,6 +27,9 @@ public class CustomerMainRespVO extends CustomerMain {
/**标签信息*/
List<BusiLabel> labelList;
/**车辆品牌型号数组*/
List<String> brandAndModel;
/**是否车主0否1是*/
private String isOwner;

View File

@ -34,8 +34,10 @@
<select id="findPage" resultType="cn.iocoder.yudao.module.custom.vo.CarMainRespVO">
SELECT
<include refid="baseCarMainColumn"></include>
<include refid="baseCarMainColumn"></include>,bcb.brand_name AS brandStr,bcm.model_name AS modelStr
FROM `base_car_main` tbcm
left join base_car_brand bcb ON bcb.deleted = 0 AND tbcm.car_brand = bcb.id
left join base_car_model bcm ON bcm.deleted = 0 AND tbcm.car_model = bcm.id
WHERE
tbcm.deleted = 0
<if test="dto.licenseNumber != null and dto.licenseNumber != ''">