车辆品牌型号优化;注释补充
This commit is contained in:
parent
4ed7438318
commit
6e2fb4d874
@ -39,13 +39,13 @@ public class CarBrandController {
|
||||
private CarBrandService carBrandService;
|
||||
|
||||
/**
|
||||
* 创建车辆品牌维护
|
||||
* 创建车辆品牌
|
||||
*
|
||||
* @param createReqVO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建车辆品牌维护")
|
||||
@Operation(summary = "创建车辆品牌")
|
||||
@PreAuthorize("@ss.hasPermission('base:car-brand:create')")
|
||||
public CommonResult<String> createCarBrand(@RequestBody CarBrandReqVO createReqVO) {
|
||||
return success(carBrandService.createCarBrand(createReqVO));
|
||||
@ -58,7 +58,7 @@ public class CarBrandController {
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新车辆品牌维护")
|
||||
@Operation(summary = "更新车辆品牌")
|
||||
@PreAuthorize("@ss.hasPermission('base:car-brand:update')")
|
||||
public CommonResult<Boolean> updateCarBrand(@RequestBody CarBrandReqVO updateReqVO) {
|
||||
carBrandService.updateCarBrand(updateReqVO);
|
||||
@ -66,7 +66,7 @@ public class CarBrandController {
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除车辆品牌维护")
|
||||
@Operation(summary = "删除车辆品牌")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('base:car-brand:delete')")
|
||||
public CommonResult<Boolean> deleteCarBrand(@RequestParam("id") String id) {
|
||||
@ -75,7 +75,7 @@ public class CarBrandController {
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得车辆品牌维护")
|
||||
@Operation(summary = "获得车辆品牌")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('base:car-brand:query')")
|
||||
public CommonResult<CarBrandRespVO> getCarBrand(@RequestParam("id") String id) {
|
||||
@ -84,7 +84,7 @@ public class CarBrandController {
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得车辆品牌维护分页")
|
||||
@Operation(summary = "获得车辆品牌分页")
|
||||
@PreAuthorize("@ss.hasPermission('base:car-brand:query')")
|
||||
public CommonResult<IPage<CarBrandRespVO>> getCarBrandPage(CarBrandReqVO pageReqVO) {
|
||||
IPage<CarBrandRespVO> pageResult = carBrandService.getCarBrandPage(pageReqVO);
|
||||
@ -92,7 +92,7 @@ public class CarBrandController {
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出车辆品牌维护 Excel")
|
||||
@Operation(summary = "导出车辆品牌 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('base:car-brand:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportCarBrandExcel(CarBrandReqVO pageReqVO,
|
||||
|
@ -150,7 +150,7 @@ public class CarModelController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/searchBrand")
|
||||
@Operation(summary = "筛选品牌型号")
|
||||
@Operation(summary = "获取品牌型号级联下拉")
|
||||
@PreAuthorize("@ss.hasPermission('base:car-main:query')")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<List<CascaderOptionsVO>> searchBrand(@RequestBody CarModelReqVO reqVO) {
|
||||
|
@ -29,6 +29,14 @@ public interface CarMainMapper extends BaseMapper<CarMain> {
|
||||
*/
|
||||
IPage<CarMainRespVO> findPage(Page<CarMainReqVO> page, @Param("dto") CarMainReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得车辆信息分页
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
CarMainRespVO findOne(@Param("id") String id);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -67,7 +67,7 @@ public interface CarModelService extends IService<CarModel> {
|
||||
IPage<CarModelRespVO> getCarModelPageByBrandId(CarModelReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 筛选品牌型号
|
||||
* 获取品牌型号级联下拉
|
||||
*
|
||||
* @param reqVO
|
||||
* @return
|
||||
|
@ -9,9 +9,7 @@ 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.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import java.util.UUID;
|
||||
@ -25,6 +23,12 @@ import java.util.UUID;
|
||||
@Validated
|
||||
public class CarBrandServiceImpl extends ServiceImpl<CarBrandMapper, CarBrand> implements CarBrandService {
|
||||
|
||||
/**
|
||||
* 创建车辆品牌维护
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
@Override
|
||||
public String createCarBrand(CarBrandReqVO createReqVO) {
|
||||
// 插入
|
||||
@ -35,6 +39,11 @@ public class CarBrandServiceImpl extends ServiceImpl<CarBrandMapper, CarBrand> i
|
||||
return carBrand.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新车辆品牌维护
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
@Override
|
||||
public void updateCarBrand(CarBrandReqVO updateReqVO) {
|
||||
|
||||
@ -43,19 +52,34 @@ public class CarBrandServiceImpl extends ServiceImpl<CarBrandMapper, CarBrand> i
|
||||
baseMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除车辆品牌维护
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
@Override
|
||||
public void deleteCarBrand(String id) {
|
||||
|
||||
// 删除
|
||||
baseMapper.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获得车辆品牌维护
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 车辆品牌维护
|
||||
*/
|
||||
@Override
|
||||
public CarBrand getCarBrand(String id) {
|
||||
return baseMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得车辆品牌维护分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 车辆品牌维护分页
|
||||
*/
|
||||
@Override
|
||||
public IPage<CarBrandRespVO> getCarBrandPage(CarBrandReqVO pageReqVO) {
|
||||
Page<CarBrandReqVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
|
@ -68,7 +68,12 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
|
||||
// 插入
|
||||
CarMain carMain = BeanUtils.toBean(createReqVO, CarMain.class);
|
||||
carMain.setCarBrand(brandAndModel.get(0));
|
||||
carMain.setCarModel(brandAndModel.get(1));
|
||||
//判断是否仅填入了品牌
|
||||
if(brandAndModel.size()>1){
|
||||
//填入了型号
|
||||
carMain.setCarModel(brandAndModel.get(1));
|
||||
}
|
||||
|
||||
|
||||
baseMapper.insert(carMain);
|
||||
// 返回
|
||||
@ -128,22 +133,22 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
|
||||
@Override
|
||||
public CarMainRespVO getCarMain(String id) {
|
||||
//数据单查
|
||||
CarMain carMain = baseMapper.selectById(id);
|
||||
CarMainRespVO carMainRespVO = baseMapper.findOne(id);
|
||||
|
||||
List<String> brandAndModel = new ArrayList<>();
|
||||
brandAndModel.add(carMain.getCarBrand());
|
||||
brandAndModel.add(carMain.getCarModel());
|
||||
CarMainRespVO result = BeanUtils.toBean(carMain, CarMainRespVO.class);
|
||||
result.setBrandAndModel(brandAndModel);
|
||||
brandAndModel.add(carMainRespVO.getCarBrand());
|
||||
brandAndModel.add(carMainRespVO.getCarModel());
|
||||
|
||||
carMainRespVO.setBrandAndModel(brandAndModel);
|
||||
//联查客户信息
|
||||
List<CustomerMainRespVO> cusList = customerCarMapper.selectCusListByCarId(id);
|
||||
result.setCusList(cusList);
|
||||
carMainRespVO.setCusList(cusList);
|
||||
|
||||
//联查标签信息
|
||||
List<BusiLabel> labelList = busiLabelService.listByMainId(id);
|
||||
result.setLabelList(labelList);
|
||||
carMainRespVO.setLabelList(labelList);
|
||||
|
||||
return result;
|
||||
return carMainRespVO;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,8 +1,6 @@
|
||||
package cn.iocoder.yudao.module.custom.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.module.custom.entity.CarBrand;
|
||||
import cn.iocoder.yudao.module.custom.entity.CarMain;
|
||||
|
||||
import cn.iocoder.yudao.module.custom.entity.CarModel;
|
||||
import cn.iocoder.yudao.module.custom.mapper.CarBrandMapper;
|
||||
import cn.iocoder.yudao.module.custom.mapper.CarModelMapper;
|
||||
@ -14,13 +12,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@ -36,6 +31,12 @@ public class CarModelServiceImpl extends ServiceImpl<CarModelMapper, CarModel> i
|
||||
@Autowired
|
||||
CarBrandMapper carBrandMapper;
|
||||
|
||||
/**
|
||||
* 创建车辆品牌型号
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
@Override
|
||||
public String createCarModel(CarModelReqVO createReqVO) {
|
||||
// 插入
|
||||
@ -46,6 +47,11 @@ public class CarModelServiceImpl extends ServiceImpl<CarModelMapper, CarModel> i
|
||||
return carModel.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新车辆品牌型号
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
@Override
|
||||
public void updateCarModel(CarModelReqVO updateReqVO) {
|
||||
// 更新
|
||||
@ -53,26 +59,47 @@ public class CarModelServiceImpl extends ServiceImpl<CarModelMapper, CarModel> i
|
||||
baseMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除车辆品牌型号
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
@Override
|
||||
public void deleteCarModel(String id) {
|
||||
|
||||
// 删除
|
||||
baseMapper.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获得车辆品牌型号
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 车辆品牌型号
|
||||
*/
|
||||
@Override
|
||||
public CarModel getCarModel(String id) {
|
||||
return baseMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得车辆品牌型号分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 车辆品牌型号分页
|
||||
*/
|
||||
@Override
|
||||
public IPage<CarModelRespVO> getCarModelPage(CarModelReqVO pageReqVO) {
|
||||
//取分页参数
|
||||
Page<CarModelReqVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
return baseMapper.findPage(page,pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得车辆品牌型号分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 车辆品牌型号分页
|
||||
*/
|
||||
@Override
|
||||
public IPage<CarModelRespVO> getCarModelPageByBrandId(CarModelReqVO pageReqVO) {
|
||||
//取分页参数
|
||||
@ -80,45 +107,18 @@ public class CarModelServiceImpl extends ServiceImpl<CarModelMapper, CarModel> i
|
||||
return baseMapper.findPage(page,pageReqVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取品牌型号级联下拉
|
||||
*
|
||||
* @param reqVO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<CascaderOptionsVO> searchBrand(CarModelReqVO reqVO) {
|
||||
|
||||
|
||||
// if (ObjectUtil.isNotEmpty(reqVO.getModelName() ) && !"".equals(reqVO.getModelName()) ){
|
||||
//有筛选的情况要根据条件查出相关父项品牌和所有子项型号,加入result。仅展示关联父项
|
||||
CarBrandReqVO brandQuery = new CarBrandReqVO();
|
||||
brandQuery.setBrandName(reqVO.getModelName());
|
||||
List<CascaderOptionsVO> nameResult = carBrandMapper.searchBrand(brandQuery);
|
||||
|
||||
|
||||
|
||||
// CarBrandReqVO brandQueryAbbName = new CarBrandReqVO();
|
||||
// brandQueryAbbName.setAbbName(reqVO.getModelName());
|
||||
//
|
||||
// List<CarBrandRespVO> brands = carBrandMapper.searchBrand(brandQueryAbbName);
|
||||
//// result.addAll(getChildModel(brands));
|
||||
//
|
||||
//
|
||||
//
|
||||
// CarModelReqVO modelQueryModelName = new CarModelReqVO();
|
||||
// modelQueryModelName.setModelName(reqVO.getModelName());
|
||||
// baseMapper.searchModel(modelQueryModelName);
|
||||
//
|
||||
// CarModelReqVO modelQueryAbbName = new CarModelReqVO();
|
||||
// modelQueryAbbName.setAbbName(reqVO.getModelName());
|
||||
// baseMapper.searchModel(modelQueryAbbName);
|
||||
|
||||
|
||||
|
||||
// }else {
|
||||
// //无筛选的情况要查出所有父项品牌,然后根据id加入其下所有子项型号
|
||||
//
|
||||
// //取所有品牌
|
||||
// List<CarBrandRespVO> brands = carBrandMapper.searchBrand(new CarBrandReqVO());
|
||||
// //根据父级品牌集合取所有的型号子选项
|
||||
//// result = getChildModel(brands);
|
||||
//
|
||||
// }
|
||||
CarBrandReqVO brandQuery = new CarBrandReqVO();
|
||||
brandQuery.setBrandName(reqVO.getModelName());
|
||||
List<CascaderOptionsVO> nameResult = carBrandMapper.searchBrand(brandQuery);
|
||||
|
||||
return getChildModel(nameResult,reqVO.getModelName());
|
||||
}
|
||||
|
@ -34,10 +34,13 @@
|
||||
|
||||
<select id="findPage" resultType="cn.iocoder.yudao.module.custom.vo.CarMainRespVO">
|
||||
SELECT
|
||||
<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
|
||||
<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 != ''">
|
||||
@ -74,6 +77,21 @@
|
||||
tbcm.car_register_date DESC
|
||||
</select>
|
||||
|
||||
<select id="findOne" resultType="cn.iocoder.yudao.module.custom.vo.CarMainRespVO">
|
||||
SELECT
|
||||
<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
|
||||
AND
|
||||
tbcm.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="isDataKeyValueRepeat" resultType="cn.iocoder.yudao.module.custom.entity.CarMain">
|
||||
SELECT
|
||||
tbcm.id
|
||||
|
Loading…
Reference in New Issue
Block a user