diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CarMainController.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CarMainController.java new file mode 100644 index 00000000..851a62ab --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/controller/admin/CarMainController.java @@ -0,0 +1,99 @@ +package cn.iocoder.yudao.module.custom.controller.admin; + +import cn.iocoder.yudao.module.custom.entity.CarMain; +import cn.iocoder.yudao.module.custom.service.CarMainService; +import cn.iocoder.yudao.module.custom.vo.CarMainReqVO; +import cn.iocoder.yudao.module.custom.vo.CarMainRespVO; +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.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.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/carMain") +@Validated +public class CarMainController { + + @Resource + private CarMainService carMainService; + + @PostMapping("/create") + @Operation(summary = "创建车辆信息") + @PreAuthorize("@ss.hasPermission('base:car-main:create')") + public CommonResult createCarMain(@RequestBody CarMainReqVO createReqVO) { + return success(carMainService.createCarMain(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新车辆信息") + @PreAuthorize("@ss.hasPermission('base:car-main:update')") + public CommonResult updateCarMain(@RequestBody CarMainReqVO updateReqVO) { + carMainService.updateCarMain(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除车辆信息") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('base:car-main:delete')") + public CommonResult deleteCarMain(@RequestParam("id") String id) { + carMainService.deleteCarMain(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得车辆信息") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('base:car-main:query')") + public CommonResult getCarMain(@RequestParam("id") String id) { + CarMain carMain = carMainService.getCarMain(id); + return success(BeanUtils.toBean(carMain, CarMainRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得车辆信息分页") + @PreAuthorize("@ss.hasPermission('base:car-main:query')") + public CommonResult> getCarMainPage(CarMainReqVO pageReqVO) { + + IPage pageResult = carMainService.getCarMainPage(pageReqVO); + return success(pageResult); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出车辆信息 Excel") + @PreAuthorize("@ss.hasPermission('base:car-main:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportCarMainExcel(CarMainReqVO pageReqVO, HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = carMainService.getCarMainPage(pageReqVO).getRecords(); + // 导出 Excel + ExcelUtils.write(response, "车辆信息.xls", "数据", CarMainRespVO.class, + BeanUtils.toBean(list, CarMainRespVO.class)); + } + +} \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/entity/CarMain.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/entity/CarMain.java new file mode 100644 index 00000000..384a95e9 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/entity/CarMain.java @@ -0,0 +1,121 @@ +package cn.iocoder.yudao.module.custom.entity; + +import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +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_main") +@Data +@EqualsAndHashCode(callSuper = true) +public class CarMain extends TenantBaseDO { + + /** + * 主键标识 + */ + @TableId(type = IdType.ASSIGN_UUID) + private String id; + /** + * 发动机号码 + */ + private String engineNumber; + /** + * 车架号 + */ + private String vin; + /** + * 车牌号 + */ + private String licenseNumber; + /** + * 车辆型号 + */ + private String carModel; + /** + * 保养日期 + */ + private LocalDateTime maintenanceDate; + /** + * 保养里程 + */ + private String maintenanceMileage; + /** + * 年检日期 + */ + private LocalDateTime inspectionDate; + /** + * 保险日期 + */ + private LocalDateTime insuranceDate; + /** + * 二级维护时间 + */ + private LocalDateTime checkDate; + /** + * 下次保养日期 + */ + private LocalDateTime nextMaintenanceDate; + /** + * 下次保养里程 + */ + private Integer nextMaintenanceMileage; + /** + * 下次年检日期 + */ + private LocalDateTime nextInspectionDate; + /** + * 保险到期日期 + */ + private LocalDateTime insuranceExpiryDate; + /** + * 下次二级维护时间 + */ + private LocalDateTime nextCheckDate; + /** + * 车辆品牌 + */ + private String carBrand; + /** + * 车辆性质:营运 非营运等 + */ + private String carNature; + /** + * 车辆类别:私家车 货车 教练车 公务车 出租车 + */ + private String carCategory; + /** + * 车辆注册日期 + */ + private LocalDateTime carRegisterDate; + /** + * 行驶证图片 + */ + private String carLicenseImg; + /** + * 最近办理业务 + */ + private String recentlyHandledBusiness; + /** + * 最近办理业务的时间 + */ + private LocalDateTime recentlyHandleBusinessTime; + + +} \ 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 new file mode 100644 index 00000000..0aaef5bc --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/mapper/CarMainMapper.java @@ -0,0 +1,24 @@ +package cn.iocoder.yudao.module.custom.mapper; + + +import cn.iocoder.yudao.module.custom.entity.CarMain; +import cn.iocoder.yudao.module.custom.vo.CarMainReqVO; +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 CarMainMapper extends BaseMapper { + + + IPage findPage(Page page, @Param("dto") CarMainReqVO pageReqVO); + +} \ No newline at end of file diff --git a/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/CarMainService.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/CarMainService.java new file mode 100644 index 00000000..1c8b1e29 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/CarMainService.java @@ -0,0 +1,60 @@ +package cn.iocoder.yudao.module.custom.service; + + +import javax.validation.*; + +import cn.iocoder.yudao.module.custom.entity.CarMain; +import cn.iocoder.yudao.module.custom.vo.CarMainReqVO; +import cn.iocoder.yudao.module.custom.vo.CarMainRespVO; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; + +import java.util.List; + +/** + * 车辆信息 Service 接口 + * + * @author 后台管理员 + */ +public interface CarMainService extends IService { + + /** + * 创建车辆信息 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + String createCarMain(CarMainReqVO createReqVO); + + /** + * 更新车辆信息 + * + * @param updateReqVO 更新信息 + */ + void updateCarMain(CarMainReqVO updateReqVO); + + /** + * 删除车辆信息 + * + * @param id 编号 + */ + void deleteCarMain(String id); + + /** + * 获得车辆信息 + * + * @param id 编号 + * @return 车辆信息 + */ + CarMain getCarMain(String id); + + /** + * 获得车辆信息分页 + * + * @param pageReqVO 分页查询 + * @return 车辆信息分页 + */ + IPage getCarMainPage(CarMainReqVO 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 new file mode 100644 index 00000000..71c16261 --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/service/impl/CarMainServiceImpl.java @@ -0,0 +1,58 @@ +package cn.iocoder.yudao.module.custom.service.impl; + +import cn.iocoder.yudao.module.custom.entity.CarMain; +import cn.iocoder.yudao.module.custom.mapper.CarMainMapper; +import cn.iocoder.yudao.module.custom.service.CarMainService; +import cn.iocoder.yudao.module.custom.vo.CarMainReqVO; +import cn.iocoder.yudao.module.custom.vo.CarMainRespVO; +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 cn.iocoder.yudao.framework.common.util.object.BeanUtils; + +/** + * 车辆信息 Service 实现类 + * + * @author 后台管理员 + */ +@Service +public class CarMainServiceImpl extends ServiceImpl implements CarMainService{ + + + @Override + public String createCarMain(CarMainReqVO createReqVO) { + // 插入 + CarMain carMain = BeanUtils.toBean(createReqVO, CarMain.class); + baseMapper.insert(carMain); + // 返回 + return carMain.getId(); + } + + @Override + public void updateCarMain(CarMainReqVO updateReqVO){ + // 更新 + CarMain updateObj = BeanUtils.toBean(updateReqVO, CarMain.class); + baseMapper.updateById(updateObj); + } + + @Override + public void deleteCarMain(String id) { + // 删除 + baseMapper.deleteById(id); + } + + + @Override + public CarMain getCarMain(String id) { + return baseMapper.selectById(id); + } + + @Override + public IPage getCarMainPage(CarMainReqVO 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/CarMainReqVO.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarMainReqVO.java new file mode 100644 index 00000000..adcb899d --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarMainReqVO.java @@ -0,0 +1,83 @@ +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_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 车辆信息分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class CarMainReqVO extends PageParam { + @Schema(description = "主键ID") + private String id; + + @Schema(description = "发动机号码") + private String engineNumber; + + @Schema(description = "车架号") + private String vin; + + @Schema(description = "车牌号") + private String licenseNumber; + + @Schema(description = "车辆型号") + private String carModel; + + @Schema(description = "保养日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime maintenanceDate; + + @Schema(description = "保养里程") + private String maintenanceMileage; + + @Schema(description = "年检日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime inspectionDate; + + @Schema(description = "保险日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime insuranceDate; + + @Schema(description = "二级维护时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime checkDate; + + @Schema(description = "车辆品牌") + private String carBrand; + + @Schema(description = "车辆性质:营运 非营运等") + private String carNature; + + @Schema(description = "车辆类别:私家车 货车 教练车 公务车 出租车") + private String carCategory; + + @Schema(description = "车辆注册日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime carRegisterDate; + + @Schema(description = "行驶证图片") + private String carLicenseImg; + + @Schema(description = "最近办理业务") + private String recentlyHandledBusiness; + + @Schema(description = "最近办理业务的时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime recentlyHandleBusinessTime; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime createTime; + + @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/CarMainRespVO.java b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarMainRespVO.java new file mode 100644 index 00000000..2d0ae7bf --- /dev/null +++ b/dl-module-base/src/main/java/cn/iocoder/yudao/module/custom/vo/CarMainRespVO.java @@ -0,0 +1,89 @@ +package cn.iocoder.yudao.module.custom.vo; + +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.*; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 车辆信息 Response VO") +@Data +@ExcelIgnoreUnannotated +public class CarMainRespVO { + + @Schema(description = "主键标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "8714") + @ExcelProperty("主键标识") + private String id; + + @Schema(description = "发动机号码", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("发动机号码") + private String engineNumber; + + @Schema(description = "车架号", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("车架号") + private String vin; + + @Schema(description = "车牌号", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("车牌号") + private String licenseNumber; + + @Schema(description = "车辆型号") + @ExcelProperty("车辆型号") + private String carModel; + + @Schema(description = "保养日期") + @ExcelProperty("保养日期") + private LocalDateTime maintenanceDate; + + @Schema(description = "保养里程") + @ExcelProperty("保养里程") + private String maintenanceMileage; + + @Schema(description = "年检日期", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("年检日期") + private LocalDateTime inspectionDate; + + @Schema(description = "保险日期") + @ExcelProperty("保险日期") + private LocalDateTime insuranceDate; + + @Schema(description = "二级维护时间") + @ExcelProperty("二级维护时间") + private LocalDateTime checkDate; + + @Schema(description = "车辆品牌", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("车辆品牌") + private String carBrand; + + @Schema(description = "车辆性质:营运 非营运等", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("车辆性质") + private String carNature; + + @Schema(description = "车辆类别:私家车 货车 教练车 公务车 出租车") + @ExcelProperty("车辆类别") + private String carCategory; + + @Schema(description = "车辆注册日期", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("车辆注册日期") + private LocalDateTime carRegisterDate; + + @Schema(description = "行驶证图片") + @ExcelProperty("行驶证图片") + private String carLicenseImg; + + @Schema(description = "最近办理业务") + @ExcelProperty("最近办理业务") + private String recentlyHandledBusiness; + + @Schema(description = "最近办理业务的时间") + @ExcelProperty("最近办理业务的时间") + private LocalDateTime recentlyHandleBusinessTime; + + @Schema(description = "创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ 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 new file mode 100644 index 00000000..fcefc423 --- /dev/null +++ b/dl-module-base/src/main/resources/mapper/custom/CarMainMapper.xml @@ -0,0 +1,71 @@ + + + + + + + id, + engine_number, + vin, + license_number, + car_model, + maintenance_date, + maintenance_mileage, + inspection_date, + insurance_date, + check_date, + next_maintenance_date, + next_maintenance_mileage, + next_inspection_date, + insurance_expiry_date, + next_check_date, + car_brand, + car_nature, + car_category, + car_register_date, + car_license_img, + recently_handled_business, + recently_handle_business_time, + deleted, + creator, + create_time, + updater, + update_time + + + + + \ No newline at end of file