From 1fcd8308a9d8c0779aad36a21558f6a093525ed9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Chhk=E2=80=9D?= <“hhk@mail.com”> Date: Mon, 5 Aug 2024 18:51:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=BD=A6=E8=BE=86=E5=93=81?= =?UTF-8?q?=E7=89=8C=E7=BB=B4=E6=8A=A4;=E8=BD=A6=E8=BE=86=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E4=BF=A1=E6=81=AF=E7=AE=A1=E7=90=86=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/admin/CarBrandController.java | 106 +++++++++++++ .../controller/admin/CarModelController.java | 149 ++++++++++++++++++ .../yudao/module/custom/entity/CarBrand.java | 84 ++++++++++ .../yudao/module/custom/entity/CarModel.java | 68 ++++++++ .../module/custom/mapper/CarBrandMapper.java | 25 +++ .../module/custom/mapper/CarMainMapper.java | 9 +- .../module/custom/mapper/CarModelMapper.java | 29 ++++ .../custom/service/CarBrandService.java | 56 +++++++ .../custom/service/CarModelService.java | 65 ++++++++ .../service/impl/CarBrandServiceImpl.java | 65 ++++++++ .../service/impl/CarMainServiceImpl.java | 8 +- .../service/impl/CarModelServiceImpl.java | 74 +++++++++ .../yudao/module/custom/vo/CarBrandReqVO.java | 47 ++++++ .../module/custom/vo/CarBrandRespVO.java | 19 +++ .../yudao/module/custom/vo/CarMainReqVO.java | 2 - .../yudao/module/custom/vo/CarModelReqVO.java | 43 +++++ .../module/custom/vo/CarModelRespVO.java | 20 +++ .../mapper/custom/CarBrandMapper.xml | 57 +++++++ .../resources/mapper/custom/CarMainMapper.xml | 16 +- .../mapper/custom/CarModelMapper.xml | 71 +++++++++ 20 files changed, 1000 insertions(+), 13 deletions(-) create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CarBrandController.java create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CarModelController.java create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/entity/CarBrand.java create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/entity/CarModel.java create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/mapper/CarBrandMapper.java create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/mapper/CarModelMapper.java create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/CarBrandService.java create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/CarModelService.java create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CarBrandServiceImpl.java create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CarModelServiceImpl.java create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarBrandReqVO.java create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarBrandRespVO.java create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarModelReqVO.java create mode 100644 dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarModelRespVO.java create mode 100644 dl-module-base/src/main/resources/mapper/custom/CarBrandMapper.xml create mode 100644 dl-module-base/src/main/resources/mapper/custom/CarModelMapper.xml diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CarBrandController.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CarBrandController.java new file mode 100644 index 00000000..18c476e8 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CarBrandController.java @@ -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 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 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 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 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> getCarBrandPage(CarBrandReqVO pageReqVO) { + IPage 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 list = carBrandService.getCarBrandPage(pageReqVO).getRecords(); + // 导出 Excel + ExcelUtils.write(response, "车辆品牌维护.xls", "数据", CarBrandRespVO.class, list); + } + +} \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CarModelController.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CarModelController.java new file mode 100644 index 00000000..022bab19 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CarModelController.java @@ -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 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 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 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 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> getCarModelPage(CarModelReqVO pageReqVO) { + IPage pageResult = carModelService.getCarModelPage(pageReqVO); + return success(pageResult); + } + + /** + * 获得车辆品牌型号分页 + * + * @param pageReqVO + * @return + */ + @GetMapping("/pageById") + @Operation(summary = "获得车辆品牌型号分页") + @PreAuthorize("@ss.hasPermission('base:car-model:query')") + public CommonResult> getCarModelPageById(CarModelReqVO pageReqVO) { + IPage 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 list = carModelService.getCarModelPage(pageReqVO).getRecords(); + // 导出 Excel + ExcelUtils.write(response, "车辆品牌型号.xls", "数据", CarModelRespVO.class, list); + } + +} \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/entity/CarBrand.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/entity/CarBrand.java new file mode 100644 index 00000000..7224b1e4 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/entity/CarBrand.java @@ -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") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 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; + +} \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/entity/CarModel.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/entity/CarModel.java new file mode 100644 index 00000000..17b0232f --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/entity/CarModel.java @@ -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") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 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; + +} \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/mapper/CarBrandMapper.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/mapper/CarBrandMapper.java new file mode 100644 index 00000000..ac5256f8 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/mapper/CarBrandMapper.java @@ -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 { + + IPage findPage(Page page,@Param("dto") CarBrandReqVO reqVO); + +} \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/mapper/CarMainMapper.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/mapper/CarMainMapper.java index f3cec350..ee4fdf9c 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/mapper/CarMainMapper.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/mapper/CarMainMapper.java @@ -27,7 +27,7 @@ public interface CarMainMapper extends BaseMapper { * @param pageReqVO * @return */ - IPage findPage(Page page, @Param("dto") CarMainReqVO pageReqVO); + IPage findPage(Page page, @Param("dto") CarMainReqVO pageReqVO); /** * 通过客户id查询车辆信息 @@ -37,6 +37,13 @@ public interface CarMainMapper extends BaseMapper { * @return java.util.List **/ List selectListByCusId( @Param("cusId") String cusId); + + /** + * 车牌号,车架号,发动机号码 查重 + * + * @param carMain + * @return + */ List isDataKeyValueRepeat(@Param("dto") CarMain carMain); } \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/mapper/CarModelMapper.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/mapper/CarModelMapper.java new file mode 100644 index 00000000..cadbceb9 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/mapper/CarModelMapper.java @@ -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 { + + IPage findPage(Page page, @Param("dto") CarModelReqVO reqVO); + + IPage getCarModelPageByBrandId(Page page, @Param("dto") CarModelReqVO reqVO); + + +} \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/CarBrandService.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/CarBrandService.java new file mode 100644 index 00000000..819e5a5a --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/CarBrandService.java @@ -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 { + + /** + * 创建车辆品牌维护 + * + * @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 getCarBrandPage(CarBrandReqVO pageReqVO); + +} \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/CarModelService.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/CarModelService.java new file mode 100644 index 00000000..d40cc39b --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/CarModelService.java @@ -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 { + + /** + * 创建车辆品牌型号 + * + * @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 getCarModelPage(CarModelReqVO pageReqVO); + + /** + * 获得车辆品牌型号分页 + * + * @param pageReqVO 分页查询 + * @return 车辆品牌型号分页 + */ + IPage getCarModelPageByBrandId(CarModelReqVO pageReqVO); + +} \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CarBrandServiceImpl.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CarBrandServiceImpl.java new file mode 100644 index 00000000..dfd890d4 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CarBrandServiceImpl.java @@ -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 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 getCarBrandPage(CarBrandReqVO pageReqVO) { + Page page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()); + return baseMapper.findPage(page,pageReqVO); + } + +} \ No newline at end of file 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 e1cee17a..2d218ada 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 @@ -111,7 +111,7 @@ public class CarMainServiceImpl extends ServiceImpl impl @Override public IPage getCarMainPage(CarMainReqVO pageReqVO) { //取分页参数 - Page page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()); + Page page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()); //分页查询 return baseMapper.findPage(page,pageReqVO); } @@ -144,7 +144,8 @@ public class CarMainServiceImpl extends ServiceImpl impl } //车架号vin 查重 - }else if (ObjectUtil.isNotEmpty(reqVO.getVin())){ + } + if (ObjectUtil.isNotEmpty(reqVO.getVin())){ CarMain target = new CarMain(); target.setVin(reqVO.getVin()); List results = baseMapper.isDataKeyValueRepeat(target); @@ -164,7 +165,8 @@ public class CarMainServiceImpl extends ServiceImpl impl } //发动机号码engine_number 查重 - }else if (ObjectUtil.isNotEmpty(reqVO.getEngineNumber())){ + } + if (ObjectUtil.isNotEmpty(reqVO.getEngineNumber())){ CarMain target = new CarMain(); target.setEngineNumber(reqVO.getEngineNumber()); List results = baseMapper.isDataKeyValueRepeat(target); diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CarModelServiceImpl.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CarModelServiceImpl.java new file mode 100644 index 00000000..9c6908fe --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CarModelServiceImpl.java @@ -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 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 getCarModelPage(CarModelReqVO pageReqVO) { + //取分页参数 + Page page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()); + return baseMapper.findPage(page,pageReqVO); + } + + @Override + public IPage getCarModelPageByBrandId(CarModelReqVO pageReqVO) { + //取分页参数 + Page page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()); + return baseMapper.findPage(page,pageReqVO); + } + +} \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarBrandReqVO.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarBrandReqVO.java new file mode 100644 index 00000000..77f85f80 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarBrandReqVO.java @@ -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; + +} \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarBrandRespVO.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarBrandRespVO.java new file mode 100644 index 00000000..3af2dbea --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarBrandRespVO.java @@ -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; + + +} \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarMainReqVO.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarMainReqVO.java index d8916df8..95f2fc40 100644 --- a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarMainReqVO.java +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarMainReqVO.java @@ -78,6 +78,4 @@ public class CarMainReqVO extends PageParam { @Schema(description = "租户ID") private String tenantId; - - } \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarModelReqVO.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarModelReqVO.java new file mode 100644 index 00000000..52c64c77 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarModelReqVO.java @@ -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; + + + +} \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarModelRespVO.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarModelRespVO.java new file mode 100644 index 00000000..f9d47bd4 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarModelRespVO.java @@ -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; + +} \ No newline at end of file diff --git a/dl-module-base/src/main/resources/mapper/custom/CarBrandMapper.xml b/dl-module-base/src/main/resources/mapper/custom/CarBrandMapper.xml new file mode 100644 index 00000000..7b2ebd87 --- /dev/null +++ b/dl-module-base/src/main/resources/mapper/custom/CarBrandMapper.xml @@ -0,0 +1,57 @@ + + + + + + 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 + + + + + \ No newline at end of file diff --git a/dl-module-base/src/main/resources/mapper/custom/CarMainMapper.xml b/dl-module-base/src/main/resources/mapper/custom/CarMainMapper.xml index 7690bf41..9f6a472f 100644 --- a/dl-module-base/src/main/resources/mapper/custom/CarMainMapper.xml +++ b/dl-module-base/src/main/resources/mapper/custom/CarMainMapper.xml @@ -68,7 +68,6 @@ AND tbcm.engine_number LIKE CONCAT('%',#{dto.engineNumber},'%') - ORDER BY tbcm.car_register_date DESC @@ -92,13 +91,16 @@ \ No newline at end of file diff --git a/dl-module-base/src/main/resources/mapper/custom/CarModelMapper.xml b/dl-module-base/src/main/resources/mapper/custom/CarModelMapper.xml new file mode 100644 index 00000000..120d79a5 --- /dev/null +++ b/dl-module-base/src/main/resources/mapper/custom/CarModelMapper.xml @@ -0,0 +1,71 @@ + + + + + + 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 + + + + + + + \ No newline at end of file