diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/PassagewayController.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/PassagewayController.java index 919ba6a10..f76d23618 100644 --- a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/PassagewayController.java +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/PassagewayController.java @@ -38,16 +38,15 @@ public class PassagewayController { @Resource private PassagewayService passagewayService; - @PostMapping("/passagewayUpload") - public BlueCardResult passagewayUpload(@RequestBody PassagewayReqDataVO passagewayReqDataVO){ + + @PostMapping("/insertPassageway") + public BlueCardResult insertPassageway(@RequestBody PassagewayReqDataVO passagewayReqDataVO){ return passagewayService.passagewayUpload(passagewayReqDataVO); } - - @PostMapping("/create") @Operation(summary = "创建通道信息") @PreAuthorize("@ss.hasPermission('parking:passageway:create')") - public CommonResult createPassageway(@Valid @RequestBody PassagewaySaveReqVO createReqVO) { + public CommonResult createPassageway(@Valid @RequestBody PassagewaySaveReqVO createReqVO) { return success(passagewayService.createPassageway(createReqVO)); } @@ -63,7 +62,7 @@ public class PassagewayController { @Operation(summary = "删除通道信息") @Parameter(name = "id", description = "编号", required = true) @PreAuthorize("@ss.hasPermission('parking:passageway:delete')") - public CommonResult deletePassageway(@RequestParam("id") String id) { + public CommonResult deletePassageway(@RequestParam("id") Long id) { passagewayService.deletePassageway(id); return success(true); } @@ -72,7 +71,7 @@ public class PassagewayController { @Operation(summary = "获得通道信息") @Parameter(name = "id", description = "编号", required = true, example = "1024") @PreAuthorize("@ss.hasPermission('parking:passageway:query')") - public CommonResult getPassageway(@RequestParam("id") String id) { + public CommonResult getPassageway(@RequestParam("id") Long id) { PassagewayDO passageway = passagewayService.getPassageway(id); return success(BeanUtils.toBean(passageway, PassagewayRespVO.class)); } @@ -90,12 +89,12 @@ public class PassagewayController { @PreAuthorize("@ss.hasPermission('parking:passageway:export')") @ApiAccessLog(operateType = EXPORT) public void exportPassagewayExcel(@Valid PassagewayPageReqVO pageReqVO, - HttpServletResponse response) throws IOException { + HttpServletResponse response) throws IOException { pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); List list = passagewayService.getPassagewayPage(pageReqVO).getList(); // 导出 Excel ExcelUtils.write(response, "通道信息.xls", "数据", PassagewayRespVO.class, - BeanUtils.toBean(list, PassagewayRespVO.class)); + BeanUtils.toBean(list, PassagewayRespVO.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/passageway/vo/PassagewayPageReqVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/vo/PassagewayPageReqVO.java index b9c284ede..04aa086ef 100644 --- a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/vo/PassagewayPageReqVO.java +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/vo/PassagewayPageReqVO.java @@ -14,6 +14,8 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) public class PassagewayPageReqVO extends PageParam { + @Schema(description = "通道 Id", example = "4961") + private String passagewayId; @Schema(description = "场库编号") private String parkNumber; diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/vo/PassagewayRespVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/vo/PassagewayRespVO.java index 6fc934cf8..2a0c39189 100644 --- a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/vo/PassagewayRespVO.java +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/vo/PassagewayRespVO.java @@ -12,6 +12,9 @@ import com.alibaba.excel.annotation.*; @Data @ExcelIgnoreUnannotated public class PassagewayRespVO { + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9494") + @ExcelProperty("id") + private Long id; @Schema(description = "通道 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7099") @ExcelProperty("通道 Id") diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/vo/PassagewaySaveReqVO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/vo/PassagewaySaveReqVO.java index 95988e110..d5d37ad70 100644 --- a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/vo/PassagewaySaveReqVO.java +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/controller/admin/passageway/vo/PassagewaySaveReqVO.java @@ -8,7 +8,8 @@ import javax.validation.constraints.*; @Schema(description = "管理后台 - 通道信息新增/修改 Request VO") @Data public class PassagewaySaveReqVO { - + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9494") + private Long id; @Schema(description = "通道 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7099") private String passagewayId; diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/dataobject/passageway/PassagewayDO.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/dataobject/passageway/PassagewayDO.java index 495b09cd5..5a7b3df14 100644 --- a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/dataobject/passageway/PassagewayDO.java +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/dataobject/passageway/PassagewayDO.java @@ -22,11 +22,6 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; @AllArgsConstructor public class PassagewayDO extends BaseDO { - /** - * 通道 Id - */ - @TableId(type = IdType.INPUT) - private String passagewayId; /** * 场库编号 */ @@ -43,5 +38,14 @@ public class PassagewayDO extends BaseDO { * 目标区域 Id */ private String targetAreaId; + /** + * id + */ + @TableId + private Long id; + /** + * 通道 Id + */ + private String passagewayId; } \ 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/passageway/PassagewayMapper.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/mysql/passageway/PassagewayMapper.java index e58ac1ea3..ccf7caba3 100644 --- a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/mysql/passageway/PassagewayMapper.java +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/dal/mysql/passageway/PassagewayMapper.java @@ -6,8 +6,10 @@ 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.passageway.PassagewayDO; +import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Mapper; import cn.iocoder.yudao.module.parking.controller.admin.passageway.vo.*; +import org.apache.ibatis.annotations.Param; /** * 通道信息 Mapper @@ -24,7 +26,10 @@ public interface PassagewayMapper extends BaseMapperX { .eqIfPresent(PassagewayDO::getSourceAreaId, reqVO.getSourceAreaId()) .eqIfPresent(PassagewayDO::getTargetAreaId, reqVO.getTargetAreaId()) .betweenIfPresent(PassagewayDO::getCreateTime, reqVO.getCreateTime()) - .orderByDesc(PassagewayDO::getPassagewayId)); + .eqIfPresent(PassagewayDO::getPassagewayId, reqVO.getPassagewayId()) + .orderByDesc(PassagewayDO::getId)); } + @Delete("DELETE FROM `passageway` WHERE `park_number` = #{parkNumber}") + int physicalDeleteByParkNumber(@Param("parkNumber") String parkNumber); } \ 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/passageway/PassagewayService.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/passageway/PassagewayService.java index ea3bd10f4..d1f5fb212 100644 --- a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/passageway/PassagewayService.java +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/passageway/PassagewayService.java @@ -21,7 +21,7 @@ public interface PassagewayService { * @param createReqVO 创建信息 * @return 编号 */ - String createPassageway(@Valid PassagewaySaveReqVO createReqVO); + Long createPassageway(@Valid PassagewaySaveReqVO createReqVO); /** * 更新通道信息 @@ -35,7 +35,7 @@ public interface PassagewayService { * * @param id 编号 */ - void deletePassageway(String id); + void deletePassageway(Long id); /** * 获得通道信息 @@ -43,7 +43,7 @@ public interface PassagewayService { * @param id 编号 * @return 通道信息 */ - PassagewayDO getPassageway(String id); + PassagewayDO getPassageway(Long id); /** * 获得通道信息分页 diff --git a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/passageway/PassagewayServiceImpl.java b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/passageway/PassagewayServiceImpl.java index 5da9e3eb9..a23a1154f 100644 --- a/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/passageway/PassagewayServiceImpl.java +++ b/ludu-module-parking/ludu-module-parking-biz/src/main/java/cn/iocoder/yudao/module/parking/service/passageway/PassagewayServiceImpl.java @@ -31,39 +31,39 @@ public class PassagewayServiceImpl implements PassagewayService { private PassagewayMapper passagewayMapper; @Override - public String createPassageway(PassagewaySaveReqVO createReqVO) { + public Long createPassageway(PassagewaySaveReqVO createReqVO) { // 插入 PassagewayDO passageway = BeanUtils.toBean(createReqVO, PassagewayDO.class); passagewayMapper.insert(passageway); // 返回 - return passageway.getPassagewayId(); + return passageway.getId(); } @Override public void updatePassageway(PassagewaySaveReqVO updateReqVO) { // 校验存在 - validatePassagewayExists(updateReqVO.getPassagewayId()); + validatePassagewayExists(updateReqVO.getId()); // 更新 PassagewayDO updateObj = BeanUtils.toBean(updateReqVO, PassagewayDO.class); passagewayMapper.updateById(updateObj); } @Override - public void deletePassageway(String id) { + public void deletePassageway(Long id) { // 校验存在 validatePassagewayExists(id); // 删除 passagewayMapper.deleteById(id); } - private void validatePassagewayExists(String id) { + private void validatePassagewayExists(Long id) { if (passagewayMapper.selectById(id) == null) { throw exception(PASSAGEWAY_NOT_EXISTS); } } @Override - public PassagewayDO getPassageway(String id) { + public PassagewayDO getPassageway(Long id) { return passagewayMapper.selectById(id); } @@ -75,7 +75,10 @@ public class PassagewayServiceImpl implements PassagewayService { @Override public BlueCardResult passagewayUpload(PassagewayReqDataVO passagewayReqDataVO) { List passagewaySaveReqVOList = passagewayReqDataVO.getDatas(); - // TODO 判断重复覆盖 + // 先物理删除对应场库编号的通道信息 + passagewayMapper.physicalDeleteByParkNumber(passagewayReqDataVO.getParkNumber()); + // 批量插入数据 + passagewayMapper.insertBatch(BeanUtils.toBean(passagewaySaveReqVOList, PassagewayDO.class)); return null; }