From cd80d93d6d80b2d4d7f679a65af8e3d5a7daaecb Mon Sep 17 00:00:00 2001 From: XinWei <2718030729@qq.com> Date: Tue, 30 Jul 2024 14:54:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=81=9C=E8=BD=A6=E5=9C=BA-=E7=99=BD=E5=90=8D?= =?UTF-8?q?=E5=8D=95=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../parking/enums/ErrorCodeConstants.java | 3 +- .../WhitelistDeliveryController.java | 95 ++++++++++++++++++ .../vo/WhitelistDeliveryPageReqVO.java | 77 +++++++++++++++ .../vo/WhitelistDeliveryRespVO.java | 92 +++++++++++++++++ .../vo/WhitelistDeliverySaveReqVO.java | 67 +++++++++++++ .../WhitelistDeliveryDO.java | 99 +++++++++++++++++++ .../WhitelistDeliveryMapper.java | 43 ++++++++ .../WhitelistDeliveryService.java | 55 +++++++++++ .../WhitelistDeliveryServiceImpl.java | 74 ++++++++++++++ .../WhitelistDeliveryMapper.xml | 12 +++ 10 files changed, 616 insertions(+), 1 deletion(-) create mode 100644 ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/whitelistdelivery/WhitelistDeliveryController.java create mode 100644 ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/whitelistdelivery/vo/WhitelistDeliveryPageReqVO.java create mode 100644 ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/whitelistdelivery/vo/WhitelistDeliveryRespVO.java create mode 100644 ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/whitelistdelivery/vo/WhitelistDeliverySaveReqVO.java create mode 100644 ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/dataobject/whitelistdelivery/WhitelistDeliveryDO.java create mode 100644 ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/mysql/whitelistdelivery/WhitelistDeliveryMapper.java create mode 100644 ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/whitelistdelivery/WhitelistDeliveryService.java create mode 100644 ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/whitelistdelivery/WhitelistDeliveryServiceImpl.java create mode 100644 ludu-module-parking/ludu-module-parking-biz/src/main/resources/mapper/whitelistdelivery/WhitelistDeliveryMapper.xml diff --git a/ludu-module-parking/ludu-module-parking-api/src/main/java/cn/iocoder/yudao/module/parking/enums/ErrorCodeConstants.java b/ludu-module-parking/ludu-module-parking-api/src/main/java/cn/iocoder/yudao/module/parking/enums/ErrorCodeConstants.java index e706f3e79..51fa9b78d 100644 --- a/ludu-module-parking/ludu-module-parking-api/src/main/java/cn/iocoder/yudao/module/parking/enums/ErrorCodeConstants.java +++ b/ludu-module-parking/ludu-module-parking-api/src/main/java/cn/iocoder/yudao/module/parking/enums/ErrorCodeConstants.java @@ -13,5 +13,6 @@ public interface ErrorCodeConstants { ErrorCode CHARGE_INFORMATION_NOT_EXISTS = new ErrorCode(1_005_001_007, "收费信息不存在"); // ========== 入场记录 1_005_001_008 ========== ErrorCode ENTRY_RECORD_NOT_EXISTS = new ErrorCode(1_005_001_008, "入场记录不存在"); - + // ========== 白名单配置 TODO 补充编号 ========== + ErrorCode WHITELIST_DELIVERY_NOT_EXISTS = new ErrorCode(1_005_001_009, "白名单配置不存在"); } diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/whitelistdelivery/WhitelistDeliveryController.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/whitelistdelivery/WhitelistDeliveryController.java new file mode 100644 index 000000000..487eed464 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/whitelistdelivery/WhitelistDeliveryController.java @@ -0,0 +1,95 @@ +package cn.iocoder.yudao.module.parking.controller.admin.whitelistdelivery; + +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.constraints.*; +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.*; + +import cn.iocoder.yudao.module.parking.controller.admin.whitelistdelivery.vo.*; +import cn.iocoder.yudao.module.parking.dal.dataobject.whitelistdelivery.WhitelistDeliveryDO; +import cn.iocoder.yudao.module.parking.service.whitelistdelivery.WhitelistDeliveryService; + +@Tag(name = "管理后台 - 白名单配置") +@RestController +@RequestMapping("/parking/whitelist-delivery") +@Validated +public class WhitelistDeliveryController { + + @Resource + private WhitelistDeliveryService whitelistDeliveryService; + + @PostMapping("/create") + @Operation(summary = "创建白名单配置") + @PreAuthorize("@ss.hasPermission('parking:whitelist-delivery:create')") + public CommonResult createWhitelistDelivery(@Valid @RequestBody WhitelistDeliverySaveReqVO createReqVO) { + return success(whitelistDeliveryService.createWhitelistDelivery(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新白名单配置") + @PreAuthorize("@ss.hasPermission('parking:whitelist-delivery:update')") + public CommonResult updateWhitelistDelivery(@Valid @RequestBody WhitelistDeliverySaveReqVO updateReqVO) { + whitelistDeliveryService.updateWhitelistDelivery(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除白名单配置") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('parking:whitelist-delivery:delete')") + public CommonResult deleteWhitelistDelivery(@RequestParam("id") Long id) { + whitelistDeliveryService.deleteWhitelistDelivery(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得白名单配置") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('parking:whitelist-delivery:query')") + public CommonResult getWhitelistDelivery(@RequestParam("id") Long id) { + WhitelistDeliveryDO whitelistDelivery = whitelistDeliveryService.getWhitelistDelivery(id); + return success(BeanUtils.toBean(whitelistDelivery, WhitelistDeliveryRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得白名单配置分页") + @PreAuthorize("@ss.hasPermission('parking:whitelist-delivery:query')") + public CommonResult> getWhitelistDeliveryPage(@Valid WhitelistDeliveryPageReqVO pageReqVO) { + PageResult pageResult = whitelistDeliveryService.getWhitelistDeliveryPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, WhitelistDeliveryRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出白名单配置 Excel") + @PreAuthorize("@ss.hasPermission('parking:whitelist-delivery:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportWhitelistDeliveryExcel(@Valid WhitelistDeliveryPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = whitelistDeliveryService.getWhitelistDeliveryPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "白名单配置.xls", "数据", WhitelistDeliveryRespVO.class, + BeanUtils.toBean(list, WhitelistDeliveryRespVO.class)); + } + +} \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/whitelistdelivery/vo/WhitelistDeliveryPageReqVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/whitelistdelivery/vo/WhitelistDeliveryPageReqVO.java new file mode 100644 index 000000000..9e6387643 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/whitelistdelivery/vo/WhitelistDeliveryPageReqVO.java @@ -0,0 +1,77 @@ +package cn.iocoder.yudao.module.parking.controller.admin.whitelistdelivery.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 WhitelistDeliveryPageReqVO extends PageParam { + + @Schema(description = "场库编号") + private String parkNumber; + + @Schema(description = "白名单数量") + private Integer size; + + @Schema(description = "车牌号") + private String plate; + + @Schema(description = "收费类型", example = "1") + private String chargeType; + + @Schema(description = "车主姓名", example = "芋艿") + private String name; + + @Schema(description = "身份证信息") + private String certificate; + + @Schema(description = "车主联系地址") + private String address; + + @Schema(description = "车主联系电话") + private String phone; + + @Schema(description = "车牌颜色") + private String plateColor; + + @Schema(description = "生效日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private String[] start; + + @Schema(description = "失效日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private String[] end; + + @Schema(description = "部门") + private String dept; + + @Schema(description = "车辆类型", example = "2") + private String carType; + + @Schema(description = "备注", example = "你猜") + private String memo; + + @Schema(description = "区域Id", example = "14435") + private Integer areaId; + + @Schema(description = "生效日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private String[] areaStart; + + @Schema(description = "失效日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private String[] areaEnd; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/whitelistdelivery/vo/WhitelistDeliveryRespVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/whitelistdelivery/vo/WhitelistDeliveryRespVO.java new file mode 100644 index 000000000..23c68b6b5 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/whitelistdelivery/vo/WhitelistDeliveryRespVO.java @@ -0,0 +1,92 @@ +package cn.iocoder.yudao.module.parking.controller.admin.whitelistdelivery.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +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 WhitelistDeliveryRespVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3476") + @ExcelProperty("id") + private Long id; + + @Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("场库编号") + private String parkNumber; + + @Schema(description = "白名单数量") + @ExcelProperty("白名单数量") + private Integer size; + + @Schema(description = "车牌号") + @ExcelProperty("车牌号") + private String plate; + + @Schema(description = "收费类型", example = "1") + @ExcelProperty("收费类型") + private String chargeType; + + @Schema(description = "车主姓名", example = "芋艿") + @ExcelProperty("车主姓名") + private String name; + + @Schema(description = "身份证信息") + @ExcelProperty("身份证信息") + private String certificate; + + @Schema(description = "车主联系地址") + @ExcelProperty("车主联系地址") + private String address; + + @Schema(description = "车主联系电话") + @ExcelProperty("车主联系电话") + private String phone; + + @Schema(description = "车牌颜色") + @ExcelProperty("车牌颜色") + private String plateColor; + + @Schema(description = "生效日期") + @ExcelProperty("生效日期") + private String start; + + @Schema(description = "失效日期") + @ExcelProperty("失效日期") + private String end; + + @Schema(description = "部门") + @ExcelProperty("部门") + private String dept; + + @Schema(description = "车辆类型", example = "2") + @ExcelProperty("车辆类型") + private String carType; + + @Schema(description = "备注", example = "你猜") + @ExcelProperty("备注") + private String memo; + + @Schema(description = "区域Id", example = "14435") + @ExcelProperty("区域Id") + private Integer areaId; + + @Schema(description = "生效日期") + @ExcelProperty("生效日期") + private String areaStart; + + @Schema(description = "失效日期") + @ExcelProperty("失效日期") + private String areaEnd; + + @Schema(description = "创建时间") + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/whitelistdelivery/vo/WhitelistDeliverySaveReqVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/whitelistdelivery/vo/WhitelistDeliverySaveReqVO.java new file mode 100644 index 000000000..225ce0d55 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/whitelistdelivery/vo/WhitelistDeliverySaveReqVO.java @@ -0,0 +1,67 @@ +package cn.iocoder.yudao.module.parking.controller.admin.whitelistdelivery.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 白名单配置新增/修改 Request VO") +@Data +public class WhitelistDeliverySaveReqVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "3476") + private Long id; + + @Schema(description = "场库编号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "场库编号不能为空") + private String parkNumber; + + @Schema(description = "白名单数量") + private Integer size; + + @Schema(description = "车牌号") + private String plate; + + @Schema(description = "收费类型", example = "1") + private String chargeType; + + @Schema(description = "车主姓名", example = "芋艿") + private String name; + + @Schema(description = "身份证信息") + private String certificate; + + @Schema(description = "车主联系地址") + private String address; + + @Schema(description = "车主联系电话") + private String phone; + + @Schema(description = "车牌颜色") + private String plateColor; + + @Schema(description = "生效日期") + private String start; + + @Schema(description = "失效日期") + private String end; + + @Schema(description = "部门") + private String dept; + + @Schema(description = "车辆类型", example = "2") + private String carType; + + @Schema(description = "备注", example = "你猜") + private String memo; + + @Schema(description = "区域Id", example = "14435") + private Integer areaId; + + @Schema(description = "生效日期") + private String areaStart; + + @Schema(description = "失效日期") + private String areaEnd; + +} \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/dataobject/whitelistdelivery/WhitelistDeliveryDO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/dataobject/whitelistdelivery/WhitelistDeliveryDO.java new file mode 100644 index 000000000..7e49190fb --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/dataobject/whitelistdelivery/WhitelistDeliveryDO.java @@ -0,0 +1,99 @@ +package cn.iocoder.yudao.module.parking.dal.dataobject.whitelistdelivery; + +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("whitelist_delivery") +@KeySequence("whitelist_delivery_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class WhitelistDeliveryDO extends BaseDO { + + /** + * id + */ + @TableId + private Long id; + /** + * 场库编号 + */ + private String parkNumber; + /** + * 白名单数量 + */ + private Integer size; + /** + * 车牌号 + */ + private String plate; + /** + * 收费类型 + */ + private String chargeType; + /** + * 车主姓名 + */ + private String name; + /** + * 身份证信息 + */ + private String certificate; + /** + * 车主联系地址 + */ + private String address; + /** + * 车主联系电话 + */ + private String phone; + /** + * 车牌颜色 + */ + private String plateColor; + /** + * 生效日期 + */ + private String start; + /** + * 失效日期 + */ + private String end; + /** + * 部门 + */ + private String dept; + /** + * 车辆类型 + */ + private String carType; + /** + * 备注 + */ + private String memo; + /** + * 区域Id + */ + private Integer areaId; + /** + * 生效日期 + */ + private String areaStart; + /** + * 失效日期 + */ + private String areaEnd; + +} \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/mysql/whitelistdelivery/WhitelistDeliveryMapper.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/mysql/whitelistdelivery/WhitelistDeliveryMapper.java new file mode 100644 index 000000000..021aecbf7 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/mysql/whitelistdelivery/WhitelistDeliveryMapper.java @@ -0,0 +1,43 @@ +package cn.iocoder.yudao.module.parking.dal.mysql.whitelistdelivery; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.module.parking.dal.dataobject.whitelistdelivery.WhitelistDeliveryDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.parking.controller.admin.whitelistdelivery.vo.*; + +/** + * 白名单配置 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface WhitelistDeliveryMapper extends BaseMapperX { + + default PageResult selectPage(WhitelistDeliveryPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(WhitelistDeliveryDO::getParkNumber, reqVO.getParkNumber()) + .eqIfPresent(WhitelistDeliveryDO::getSize, reqVO.getSize()) + .eqIfPresent(WhitelistDeliveryDO::getPlate, reqVO.getPlate()) + .eqIfPresent(WhitelistDeliveryDO::getChargeType, reqVO.getChargeType()) + .likeIfPresent(WhitelistDeliveryDO::getName, reqVO.getName()) + .eqIfPresent(WhitelistDeliveryDO::getCertificate, reqVO.getCertificate()) + .eqIfPresent(WhitelistDeliveryDO::getAddress, reqVO.getAddress()) + .eqIfPresent(WhitelistDeliveryDO::getPhone, reqVO.getPhone()) + .eqIfPresent(WhitelistDeliveryDO::getPlateColor, reqVO.getPlateColor()) + .betweenIfPresent(WhitelistDeliveryDO::getStart, reqVO.getStart()) + .betweenIfPresent(WhitelistDeliveryDO::getEnd, reqVO.getEnd()) + .eqIfPresent(WhitelistDeliveryDO::getDept, reqVO.getDept()) + .eqIfPresent(WhitelistDeliveryDO::getCarType, reqVO.getCarType()) + .eqIfPresent(WhitelistDeliveryDO::getMemo, reqVO.getMemo()) + .eqIfPresent(WhitelistDeliveryDO::getAreaId, reqVO.getAreaId()) + .betweenIfPresent(WhitelistDeliveryDO::getAreaStart, reqVO.getAreaStart()) + .betweenIfPresent(WhitelistDeliveryDO::getAreaEnd, reqVO.getAreaEnd()) + .betweenIfPresent(WhitelistDeliveryDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(WhitelistDeliveryDO::getId)); + } + +} \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/whitelistdelivery/WhitelistDeliveryService.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/whitelistdelivery/WhitelistDeliveryService.java new file mode 100644 index 000000000..c5fa111d8 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/whitelistdelivery/WhitelistDeliveryService.java @@ -0,0 +1,55 @@ +package cn.iocoder.yudao.module.parking.service.whitelistdelivery; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.module.parking.controller.admin.whitelistdelivery.vo.*; +import cn.iocoder.yudao.module.parking.dal.dataobject.whitelistdelivery.WhitelistDeliveryDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; + +/** + * 白名单配置 Service 接口 + * + * @author 芋道源码 + */ +public interface WhitelistDeliveryService { + + /** + * 创建白名单配置 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createWhitelistDelivery(@Valid WhitelistDeliverySaveReqVO createReqVO); + + /** + * 更新白名单配置 + * + * @param updateReqVO 更新信息 + */ + void updateWhitelistDelivery(@Valid WhitelistDeliverySaveReqVO updateReqVO); + + /** + * 删除白名单配置 + * + * @param id 编号 + */ + void deleteWhitelistDelivery(Long id); + + /** + * 获得白名单配置 + * + * @param id 编号 + * @return 白名单配置 + */ + WhitelistDeliveryDO getWhitelistDelivery(Long id); + + /** + * 获得白名单配置分页 + * + * @param pageReqVO 分页查询 + * @return 白名单配置分页 + */ + PageResult getWhitelistDeliveryPage(WhitelistDeliveryPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/whitelistdelivery/WhitelistDeliveryServiceImpl.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/whitelistdelivery/WhitelistDeliveryServiceImpl.java new file mode 100644 index 000000000..865606ca5 --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/whitelistdelivery/WhitelistDeliveryServiceImpl.java @@ -0,0 +1,74 @@ +package cn.iocoder.yudao.module.parking.service.whitelistdelivery; + +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import cn.iocoder.yudao.module.parking.controller.admin.whitelistdelivery.vo.*; +import cn.iocoder.yudao.module.parking.dal.dataobject.whitelistdelivery.WhitelistDeliveryDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; + +import cn.iocoder.yudao.module.parking.dal.mysql.whitelistdelivery.WhitelistDeliveryMapper; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.parking.enums.ErrorCodeConstants.*; + +/** + * 白名单配置 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class WhitelistDeliveryServiceImpl implements WhitelistDeliveryService { + + @Resource + private WhitelistDeliveryMapper whitelistDeliveryMapper; + + @Override + public Long createWhitelistDelivery(WhitelistDeliverySaveReqVO createReqVO) { + // 插入 + WhitelistDeliveryDO whitelistDelivery = BeanUtils.toBean(createReqVO, WhitelistDeliveryDO.class); + whitelistDeliveryMapper.insert(whitelistDelivery); + // 返回 + return whitelistDelivery.getId(); + } + + @Override + public void updateWhitelistDelivery(WhitelistDeliverySaveReqVO updateReqVO) { + // 校验存在 + validateWhitelistDeliveryExists(updateReqVO.getId()); + // 更新 + WhitelistDeliveryDO updateObj = BeanUtils.toBean(updateReqVO, WhitelistDeliveryDO.class); + whitelistDeliveryMapper.updateById(updateObj); + } + + @Override + public void deleteWhitelistDelivery(Long id) { + // 校验存在 + validateWhitelistDeliveryExists(id); + // 删除 + whitelistDeliveryMapper.deleteById(id); + } + + private void validateWhitelistDeliveryExists(Long id) { + if (whitelistDeliveryMapper.selectById(id) == null) { + throw exception(WHITELIST_DELIVERY_NOT_EXISTS); + } + } + + @Override + public WhitelistDeliveryDO getWhitelistDelivery(Long id) { + return whitelistDeliveryMapper.selectById(id); + } + + @Override + public PageResult getWhitelistDeliveryPage(WhitelistDeliveryPageReqVO pageReqVO) { + return whitelistDeliveryMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/resources/mapper/whitelistdelivery/WhitelistDeliveryMapper.xml b/ludu-module-parking/ludu-module-parking-biz/src/main/resources/mapper/whitelistdelivery/WhitelistDeliveryMapper.xml new file mode 100644 index 000000000..4942a339c --- /dev/null +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/resources/mapper/whitelistdelivery/WhitelistDeliveryMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file