新增车辆品牌维护;车辆基础信息管理优化

This commit is contained in:
“hhk” 2024-08-05 18:51:33 +08:00
parent 9fd489d5a5
commit 1fcd8308a9
20 changed files with 1000 additions and 13 deletions

View File

@ -0,0 +1,106 @@
package cn.iocoder.yudao.module.custom.controller.admin;
import cn.iocoder.yudao.module.custom.entity.CarBrand;
import cn.iocoder.yudao.module.custom.service.CarBrandService;
import cn.iocoder.yudao.module.custom.vo.CarBrandReqVO;
import cn.iocoder.yudao.module.custom.vo.CarBrandRespVO;
import cn.iocoder.yudao.module.custom.vo.CarBrandReqVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
@Tag(name = "管理后台 - 车辆品牌维护")
@RestController
@RequestMapping("/base/carBrand")
@Validated
public class CarBrandController {
@Resource
private CarBrandService carBrandService;
/**
* 创建车辆品牌维护
*
* @param createReqVO
* @return
*/
@PostMapping("/create")
@Operation(summary = "创建车辆品牌维护")
@PreAuthorize("@ss.hasPermission('base:car-brand:create')")
public CommonResult<String> createCarBrand(@RequestBody CarBrandReqVO createReqVO) {
return success(carBrandService.createCarBrand(createReqVO));
}
/**
* 更新车辆品牌
*
* @param updateReqVO
* @return
*/
@PutMapping("/update")
@Operation(summary = "更新车辆品牌维护")
@PreAuthorize("@ss.hasPermission('base:car-brand:update')")
public CommonResult<Boolean> updateCarBrand(@RequestBody CarBrandReqVO updateReqVO) {
carBrandService.updateCarBrand(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除车辆品牌维护")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('base:car-brand:delete')")
public CommonResult<Boolean> deleteCarBrand(@RequestParam("id") String id) {
carBrandService.deleteCarBrand(id);
return success(true);
}
@GetMapping("/get")
@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) {
CarBrand carBrand = carBrandService.getCarBrand(id);
return success(BeanUtils.toBean(carBrand, CarBrandRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得车辆品牌维护分页")
@PreAuthorize("@ss.hasPermission('base:car-brand:query')")
public CommonResult<IPage<CarBrandRespVO>> getCarBrandPage(CarBrandReqVO pageReqVO) {
IPage<CarBrandRespVO> pageResult = carBrandService.getCarBrandPage(pageReqVO);
return success(pageResult);
}
@GetMapping("/export-excel")
@Operation(summary = "导出车辆品牌维护 Excel")
@PreAuthorize("@ss.hasPermission('base:car-brand:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportCarBrandExcel(CarBrandReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<CarBrandRespVO> list = carBrandService.getCarBrandPage(pageReqVO).getRecords();
// 导出 Excel
ExcelUtils.write(response, "车辆品牌维护.xls", "数据", CarBrandRespVO.class, list);
}
}

View File

@ -0,0 +1,149 @@
package cn.iocoder.yudao.module.custom.controller.admin;
import cn.iocoder.yudao.module.custom.entity.CarModel;
import cn.iocoder.yudao.module.custom.service.CarModelService;
import cn.iocoder.yudao.module.custom.vo.CarMainRespVO;
import cn.iocoder.yudao.module.custom.vo.CarModelReqVO;
import cn.iocoder.yudao.module.custom.vo.CarModelRespVO;
import cn.iocoder.yudao.module.custom.vo.CarModelReqVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
@Tag(name = "管理后台 - 车辆品牌型号")
@RestController
@RequestMapping("/base/carModel")
@Validated
public class CarModelController {
@Autowired
private CarModelService carModelService;
/**
* 创建车辆品牌型号
*
* @param createReqVO
* @return
*/
@PostMapping("/create")
@Operation(summary = "创建车辆品牌型号")
@PreAuthorize("@ss.hasPermission('base:car-model:create')")
public CommonResult<String> createCarModel(@RequestBody CarModelReqVO createReqVO) {
return success(carModelService.createCarModel(createReqVO));
}
/**
* 更新车辆品牌型号
*
* @param updateReqVO
* @return
*/
@PutMapping("/update")
@Operation(summary = "更新车辆品牌型号")
@PreAuthorize("@ss.hasPermission('base:car-model:update')")
public CommonResult<Boolean> updateCarModel(@RequestBody CarModelReqVO updateReqVO) {
carModelService.updateCarModel(updateReqVO);
return success(true);
}
/**
* 删除车辆品牌型号
*
* @param id
* @return
*/
@DeleteMapping("/delete")
@Operation(summary = "删除车辆品牌型号")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('base:car-model:delete')")
public CommonResult<Boolean> deleteCarModel(@RequestParam("id") String id) {
carModelService.deleteCarModel(id);
return success(true);
}
/**
* 获得车辆品牌型号
*
* @param id
* @return
*/
@GetMapping("/get")
@Operation(summary = "获得车辆品牌型号")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('base:car-model:query')")
public CommonResult<CarModelRespVO> getCarModel(@RequestParam("id") String id) {
CarModel carModel = carModelService.getCarModel(id);
return success(BeanUtils.toBean(carModel, CarModelRespVO.class));
}
/**
* 获得车辆品牌型号分页
*
* @param pageReqVO
* @return
*/
@GetMapping("/page")
@Operation(summary = "获得车辆品牌型号分页")
@PreAuthorize("@ss.hasPermission('base:car-model:query')")
public CommonResult<IPage<CarModelRespVO>> getCarModelPage(CarModelReqVO pageReqVO) {
IPage<CarModelRespVO> pageResult = carModelService.getCarModelPage(pageReqVO);
return success(pageResult);
}
/**
* 获得车辆品牌型号分页
*
* @param pageReqVO
* @return
*/
@GetMapping("/pageById")
@Operation(summary = "获得车辆品牌型号分页")
@PreAuthorize("@ss.hasPermission('base:car-model:query')")
public CommonResult<IPage<CarModelRespVO>> getCarModelPageById(CarModelReqVO pageReqVO) {
IPage<CarModelRespVO> pageResult = carModelService.getCarModelPageByBrandId(pageReqVO);
return success(pageResult);
}
/**
* 导出车辆品牌型号
*
* @param pageReqVO
* @param response
* @throws IOException
*/
@GetMapping("/export-excel")
@Operation(summary = "导出车辆品牌型号 Excel")
@PreAuthorize("@ss.hasPermission('base:car-model:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportCarModelExcel(CarModelReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<CarModelRespVO> list = carModelService.getCarModelPage(pageReqVO).getRecords();
// 导出 Excel
ExcelUtils.write(response, "车辆品牌型号.xls", "数据", CarModelRespVO.class, list);
}
}

View File

@ -0,0 +1,84 @@
package cn.iocoder.yudao.module.custom.entity;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 车辆品牌维护 DO
*
* @author 后台管理员
*/
@TableName("base_car_brand")
@KeySequence("base_car_brand_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CarBrand extends BaseDO {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_UUID)
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1072")
@ExcelProperty("主键")
private String id;
/**
* 品牌名称
*/
@Schema(description = "品牌名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@ExcelProperty("品牌名称")
private String brandName;
/**
* 状态0正常 1停用
*/
@Schema(description = "状态0正常 1停用", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("状态0正常 1停用")
private Integer status;
/**
* 备注
*/
@Schema(description = "备注", example = "你说的对")
@ExcelProperty("备注")
private String remark;
/**
* 车标图片
*/
@Schema(description = "车标图片")
@ExcelProperty("车标图片")
private String logoImg;
/**
* 品牌英文名称
*/
@Schema(description = "品牌英文名称", example = "李四")
@ExcelProperty("品牌英文名称")
private String englishName;
/**
* 品牌缩写
*/
@Schema(description = "品牌缩写", example = "李四")
@ExcelProperty("品牌缩写")
private String abbName;
/**
* 品牌类型 01国产车 02韩系车 03日系车 04美系车 05欧系车 06德系车
*
*/
@Schema(description = "品牌类型 01国产车 02韩系车 03日系车 04美系车 05欧系车 06德系车", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty(value = "品牌类型 01国产车 02韩系车 03日系车 04美系车 05欧系车 06德系车", converter = DictConvert.class)
private String brandType;
/**
* 品牌键值
*/
@Schema(description = "品牌键值", example = "1")
private String brandValue;
}

View File

@ -0,0 +1,68 @@
package cn.iocoder.yudao.module.custom.entity;
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 车辆品牌型号 DO
*
* @author 后台管理员
*/
@TableName("base_car_model")
@KeySequence("base_car_model_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CarModel extends BaseDO {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_UUID)
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "18805")
@ExcelProperty("主键")
private String id;
/**
* 排序
*/
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("排序")
private Integer sort;
/**
* 型号名称
*/
@Schema(description = "型号名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
@ExcelProperty("型号名称")
private String modelName;
/**
* 型号键值
*/
private String modelValue;
/**
* 备注
*/
@Schema(description = "备注", example = "随便")
@ExcelProperty("备注")
private String remark;
/**
* 型号缩写
*/
@Schema(description = "型号缩写", example = "李四")
@ExcelProperty("型号缩写")
private String abbName;
/**
* 品牌id
*/
private String brandId;
}

View File

@ -0,0 +1,25 @@
package cn.iocoder.yudao.module.custom.mapper;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.custom.entity.CarBrand;
import cn.iocoder.yudao.module.custom.entity.CarMain;
import cn.iocoder.yudao.module.custom.vo.CarBrandReqVO;
import cn.iocoder.yudao.module.custom.vo.CarBrandRespVO;
import cn.iocoder.yudao.module.custom.vo.CarMainRespVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 车辆品牌维护 Mapper
*
* @author 后台管理员
*/
@Mapper
public interface CarBrandMapper extends BaseMapper<CarBrand> {
IPage<CarBrandRespVO> findPage(Page<CarBrandReqVO> page,@Param("dto") CarBrandReqVO reqVO);
}

View File

@ -27,7 +27,7 @@ public interface CarMainMapper extends BaseMapper<CarMain> {
* @param pageReqVO
* @return
*/
IPage<CarMainRespVO> findPage(Page<CarMain> page, @Param("dto") CarMainReqVO pageReqVO);
IPage<CarMainRespVO> findPage(Page<CarMainReqVO> page, @Param("dto") CarMainReqVO pageReqVO);
/**
* 通过客户id查询车辆信息
@ -37,6 +37,13 @@ public interface CarMainMapper extends BaseMapper<CarMain> {
* @return java.util.List<cn.iocoder.yudao.module.custom.entity.CarMain>
**/
List<CarMainRespVO> selectListByCusId( @Param("cusId") String cusId);
/**
* 车牌号车架号发动机号码 查重
*
* @param carMain
* @return
*/
List<CarMain> isDataKeyValueRepeat(@Param("dto") CarMain carMain);
}

View File

@ -0,0 +1,29 @@
package cn.iocoder.yudao.module.custom.mapper;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.custom.entity.CarMain;
import cn.iocoder.yudao.module.custom.entity.CarModel;
import cn.iocoder.yudao.module.custom.vo.CarMainReqVO;
import cn.iocoder.yudao.module.custom.vo.CarMainRespVO;
import cn.iocoder.yudao.module.custom.vo.CarModelReqVO;
import cn.iocoder.yudao.module.custom.vo.CarModelRespVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 车辆品牌型号 Mapper
*
* @author 后台管理员
*/
@Mapper
public interface CarModelMapper extends BaseMapper<CarModel> {
IPage<CarModelRespVO> findPage(Page<CarModelReqVO> page, @Param("dto") CarModelReqVO reqVO);
IPage<CarModelRespVO> getCarModelPageByBrandId(Page<CarModelReqVO> page, @Param("dto") CarModelReqVO reqVO);
}

View File

@ -0,0 +1,56 @@
package cn.iocoder.yudao.module.custom.service;
import javax.validation.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.custom.entity.CarBrand;
import cn.iocoder.yudao.module.custom.vo.CarBrandReqVO;
import cn.iocoder.yudao.module.custom.vo.CarBrandRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 车辆品牌维护 Service 接口
*
* @author 后台管理员
*/
public interface CarBrandService extends IService<CarBrand> {
/**
* 创建车辆品牌维护
*
* @param createReqVO 创建信息
* @return 编号
*/
String createCarBrand(@Valid CarBrandReqVO createReqVO);
/**
* 更新车辆品牌维护
*
* @param updateReqVO 更新信息
*/
void updateCarBrand(@Valid CarBrandReqVO updateReqVO);
/**
* 删除车辆品牌维护
*
* @param id 编号
*/
void deleteCarBrand(String id);
/**
* 获得车辆品牌维护
*
* @param id 编号
* @return 车辆品牌维护
*/
CarBrand getCarBrand(String id);
/**
* 获得车辆品牌维护分页
*
* @param pageReqVO 分页查询
* @return 车辆品牌维护分页
*/
IPage<CarBrandRespVO> getCarBrandPage(CarBrandReqVO pageReqVO);
}

View File

@ -0,0 +1,65 @@
package cn.iocoder.yudao.module.custom.service;
import javax.validation.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.custom.entity.CarModel;
import cn.iocoder.yudao.module.custom.vo.CarModelReqVO;
import cn.iocoder.yudao.module.custom.vo.CarModelReqVO;
import cn.iocoder.yudao.module.custom.vo.CarModelRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 车辆品牌型号 Service 接口
*
* @author 后台管理员
*/
public interface CarModelService extends IService<CarModel> {
/**
* 创建车辆品牌型号
*
* @param createReqVO 创建信息
* @return 编号
*/
String createCarModel(@Valid CarModelReqVO createReqVO);
/**
* 更新车辆品牌型号
*
* @param updateReqVO 更新信息
*/
void updateCarModel(@Valid CarModelReqVO updateReqVO);
/**
* 删除车辆品牌型号
*
* @param id 编号
*/
void deleteCarModel(String id);
/**
* 获得车辆品牌型号
*
* @param id 编号
* @return 车辆品牌型号
*/
CarModel getCarModel(String id);
/**
* 获得车辆品牌型号分页
*
* @param pageReqVO 分页查询
* @return 车辆品牌型号分页
*/
IPage<CarModelRespVO> getCarModelPage(CarModelReqVO pageReqVO);
/**
* 获得车辆品牌型号分页
*
* @param pageReqVO 分页查询
* @return 车辆品牌型号分页
*/
IPage<CarModelRespVO> getCarModelPageByBrandId(CarModelReqVO pageReqVO);
}

View File

@ -0,0 +1,65 @@
package cn.iocoder.yudao.module.custom.service.impl;
import cn.iocoder.yudao.module.custom.entity.CarBrand;
import cn.iocoder.yudao.module.custom.mapper.CarBrandMapper;
import cn.iocoder.yudao.module.custom.service.CarBrandService;
import cn.iocoder.yudao.module.custom.vo.*;
import cn.iocoder.yudao.module.custom.vo.CarBrandReqVO;
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;
/**
* 车辆品牌维护 Service 实现类
*
* @author 后台管理员
*/
@Service
@Validated
public class CarBrandServiceImpl extends ServiceImpl<CarBrandMapper, CarBrand> implements CarBrandService {
@Override
public String createCarBrand(CarBrandReqVO createReqVO) {
// 插入
CarBrand carBrand = BeanUtils.toBean(createReqVO, CarBrand.class);
carBrand.setBrandValue(UUID.randomUUID().toString());
baseMapper.insert(carBrand);
// 返回
return carBrand.getId();
}
@Override
public void updateCarBrand(CarBrandReqVO updateReqVO) {
// 更新
CarBrand updateObj = BeanUtils.toBean(updateReqVO, CarBrand.class);
baseMapper.updateById(updateObj);
}
@Override
public void deleteCarBrand(String id) {
// 删除
baseMapper.deleteById(id);
}
@Override
public CarBrand getCarBrand(String id) {
return baseMapper.selectById(id);
}
@Override
public IPage<CarBrandRespVO> getCarBrandPage(CarBrandReqVO pageReqVO) {
Page<CarBrandReqVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
return baseMapper.findPage(page,pageReqVO);
}
}

View File

@ -111,7 +111,7 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
@Override
public IPage<CarMainRespVO> getCarMainPage(CarMainReqVO pageReqVO) {
//取分页参数
Page<CarMain> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
Page<CarMainReqVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
//分页查询
return baseMapper.findPage(page,pageReqVO);
}
@ -144,7 +144,8 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
}
//车架号vin 查重
}else if (ObjectUtil.isNotEmpty(reqVO.getVin())){
}
if (ObjectUtil.isNotEmpty(reqVO.getVin())){
CarMain target = new CarMain();
target.setVin(reqVO.getVin());
List<CarMain> results = baseMapper.isDataKeyValueRepeat(target);
@ -164,7 +165,8 @@ public class CarMainServiceImpl extends ServiceImpl<CarMainMapper, CarMain> impl
}
//发动机号码engine_number 查重
}else if (ObjectUtil.isNotEmpty(reqVO.getEngineNumber())){
}
if (ObjectUtil.isNotEmpty(reqVO.getEngineNumber())){
CarMain target = new CarMain();
target.setEngineNumber(reqVO.getEngineNumber());
List<CarMain> results = baseMapper.isDataKeyValueRepeat(target);

View File

@ -0,0 +1,74 @@
package cn.iocoder.yudao.module.custom.service.impl;
import cn.iocoder.yudao.module.custom.entity.CarMain;
import cn.iocoder.yudao.module.custom.entity.CarModel;
import cn.iocoder.yudao.module.custom.mapper.CarModelMapper;
import cn.iocoder.yudao.module.custom.service.CarModelService;
import cn.iocoder.yudao.module.custom.vo.*;
import cn.iocoder.yudao.module.custom.vo.CarModelReqVO;
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;
/**
* 车辆品牌型号 Service 实现类
*
* @author 后台管理员
*/
@Service
@Validated
public class CarModelServiceImpl extends ServiceImpl<CarModelMapper, CarModel> implements CarModelService {
@Override
public String createCarModel(CarModelReqVO createReqVO) {
// 插入
CarModel carModel = BeanUtils.toBean(createReqVO, CarModel.class);
carModel.setModelValue(UUID.randomUUID().toString());
baseMapper.insert(carModel);
// 返回
return carModel.getId();
}
@Override
public void updateCarModel(CarModelReqVO updateReqVO) {
// 更新
CarModel updateObj = BeanUtils.toBean(updateReqVO, CarModel.class);
baseMapper.updateById(updateObj);
}
@Override
public void deleteCarModel(String id) {
// 删除
baseMapper.deleteById(id);
}
@Override
public CarModel getCarModel(String id) {
return baseMapper.selectById(id);
}
@Override
public IPage<CarModelRespVO> getCarModelPage(CarModelReqVO pageReqVO) {
//取分页参数
Page<CarModelReqVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
return baseMapper.findPage(page,pageReqVO);
}
@Override
public IPage<CarModelRespVO> getCarModelPageByBrandId(CarModelReqVO pageReqVO) {
//取分页参数
Page<CarModelReqVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
return baseMapper.findPage(page,pageReqVO);
}
}

View File

@ -0,0 +1,47 @@
package cn.iocoder.yudao.module.custom.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 车辆品牌维护分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CarBrandReqVO extends PageParam {
@Schema(description = "品牌名称", example = "李四")
private String brandName;
@Schema(description = "状态0正常 1停用", example = "2")
private Integer status;
@Schema(description = "备注", example = "你说的对")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private LocalDateTime createTime;
@Schema(description = "车标图片")
private String logoImg;
@Schema(description = "品牌英文名称", example = "李四")
private String englishName;
@Schema(description = "品牌缩写", example = "李四")
private String abbName;
@Schema(description = "品牌类型 01国产车 02韩系车 03日系车 04美系车 05欧系车 06德系车", example = "1")
private String brandType;
@Schema(description = "品牌键值")
private String brandValue;
}

View File

@ -0,0 +1,19 @@
package cn.iocoder.yudao.module.custom.vo;
import cn.iocoder.yudao.module.custom.entity.CarBrand;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 车辆品牌维护 Response VO")
@Data
@ExcelIgnoreUnannotated
public class CarBrandRespVO extends CarBrand {
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -78,6 +78,4 @@ public class CarMainReqVO extends PageParam {
@Schema(description = "租户ID")
private String tenantId;
}

View File

@ -0,0 +1,43 @@
package cn.iocoder.yudao.module.custom.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 车辆品牌型号分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CarModelReqVO extends PageParam {
@Schema(description = "排序")
private Integer sort;
@Schema(description = "型号名称", example = "李四")
private String modelName;
@Schema(description = "备注", example = "随便")
private String remark;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private LocalDateTime createTime;
@Schema(description = "型号缩写", example = "李四")
private String abbName;
@Schema(description = "型号缩写", example = "李四")
private String modelValue;
@Schema(description = "品牌id", example = "李四")
private String brandId;
}

View File

@ -0,0 +1,20 @@
package cn.iocoder.yudao.module.custom.vo;
import cn.iocoder.yudao.module.custom.entity.CarModel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 车辆品牌型号 Response VO")
@Data
@ExcelIgnoreUnannotated
public class CarModelRespVO extends CarModel {
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.custom.mapper.CarBrandMapper">
<sql id="baseCarBrandColumn">
tbcb.id,
tbcb.brand_name,
tbcb.brand_type,
tbcb.status,
tbcb.remark,
tbcb.creator,
tbcb.create_time,
tbcb.updater,
tbcb.update_time,
tbcb.logo_img,
tbcb.english_name,
tbcb.abb_name,
tbcb.brand_value,
tbcb.deleted,
tbcb.tenant_id
</sql>
<select id="findPage" resultType="cn.iocoder.yudao.module.custom.vo.CarBrandRespVO">
SELECT
<include refid="baseCarBrandColumn"></include>
FROM `base_car_brand` tbcb
WHERE
tbcb.deleted = 0
<if test="dto.brandName != null and dto.brandName != ''">
AND tbcb.brand_name LIKE CONCAT('%',#{dto.brandName},'%')
</if>
<if test="dto.brandType != null and dto.brandType != ''">
AND tbcb.brand_type = #{dto.brandType}
</if>
<if test="dto.status != null and dto.status != ''">
AND tbcb.status = #{dto.status}
</if>
<if test="dto.remark != null and dto.remark != ''">
AND tbcb.remark = #{dto.remark}
</if>
<if test="dto.brandValue != null and dto.brandValue != ''">
AND tbcb.brand_value = #{dto.brandValue}
</if>
<if test="dto.englishName != null and dto.englishName != ''">
AND tbcb.english_name LIKE CONCAT('%',#{dto.englishName},'%')
</if>
<if test="dto.abbName != null and dto.abbName != ''">
AND tbcb.abb_name LIKE CONCAT('%',#{dto.abbName},'%')
</if>
<if test="dto.createTime != null">
AND tbcb.create_time = #{dto.createTime}
</if>
ORDER BY
tbcb.create_time DESC
</select>
</mapper>

View File

@ -68,7 +68,6 @@
<if test="dto.engineNumber != null and dto.engineNumber != ''">
AND tbcm.engine_number LIKE CONCAT('%',#{dto.engineNumber},'%')
</if>
ORDER BY
tbcm.car_register_date DESC
</select>
@ -92,13 +91,16 @@
</select>
<select id="selectListByCusId" resultType="cn.iocoder.yudao.module.custom.vo.CarMainRespVO">
SELECT
<include refid="baseCarMainColumn"></include>,main.is_owner AS isOwner
<include refid="baseCarMainColumn"></include>,
main.is_owner AS isOwner
FROM
base_customer_car main
LEFT JOIN base_car_main tbcm ON main.car_id = tbcm.id AND tbcm.deleted = 0
base_customer_car main
LEFT JOIN
base_car_main tbcm ON main.car_id = tbcm.id AND tbcm.deleted = 0
WHERE
main.deleted = 0
AND main.cus_id = #{cusId}
ORDER BY main.create_time DESC
main.deleted = 0
AND main.cus_id = #{cusId}
ORDER BY
main.create_time DESC
</select>
</mapper>

View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.custom.mapper.CarModelMapper">
<sql id="baseCarModelColumn">
tbcmod.id,
tbcmod.sort,
tbcmod.model_name,
tbcmod.model_value,
tbcmod.remark,
tbcmod.creator,
tbcmod.create_time,
tbcmod.updater,
tbcmod.update_time,
tbcmod.deleted,
tbcmod.abb_name,
tbcmod.brand_id,
tbcmod.tenant_id
</sql>
<select id="findPage" resultType="cn.iocoder.yudao.module.custom.vo.CarModelRespVO">
SELECT
<include refid="baseCarModelColumn"></include>
FROM `base_car_model` tbcmod
WHERE
tbcmod.deleted = 0
<if test="dto.brandId != null and dto.brandId != ''">
AND tbcmod.brand_id = #{dto.brandId}
</if>
<if test="dto.modelName != null and dto.modelName != ''">
AND tbcmod.model_name LIKE CONCAT('%',#{dto.modelName},'%')
</if>
<if test="dto.modelValue != null and dto.modelValue != ''">
AND tbcmod.model_value = #{dto.modelValue}
</if>
<if test="dto.remark != null and dto.remark != ''">
AND tbcmod.remark LIKE CONCAT('%',#{dto.remark},'%')
</if>
<if test="dto.abbName != null and dto.abbName != ''">
AND tbcmod.abb_name LIKE CONCAT('%',#{dto.abbName},'%')
</if>
ORDER BY
tbcmod.sort DESC
</select>
<select id="getCarModelPageByBrandId" resultType="cn.iocoder.yudao.module.custom.vo.CarModelRespVO">
SELECT
<include refid="baseCarModelColumn"></include>
FROM `base_car_model` tbcmod
WHERE
tbcmod.deleted = 0
<if test="dto.brandId != null and dto.brandId != ''">
AND tbcmod.brand_id = #{dto.brandId}
</if>
<if test="dto.modelName != null and dto.modelName != ''">
AND tbcmod.model_name LIKE CONCAT('%',#{dto.modelName},'%')
</if>
<if test="dto.modelValue != null and dto.modelValue != ''">
AND tbcmod.model_value = #{dto.modelValue}
</if>
<if test="dto.remark != null and dto.remark != ''">
AND tbcmod.remark LIKE CONCAT('%',#{dto.remark},'%')
</if>
<if test="dto.abbName != null and dto.abbName != ''">
AND tbcmod.abb_name LIKE CONCAT('%',#{dto.abbName},'%')
</if>
ORDER BY
tbcmod.sort DESC
</select>
</mapper>