From b84a6ede57a0cf902a43a65d86e5b793997250b8 Mon Sep 17 00:00:00 2001 From: eight <641137800@qq.com> Date: 星期五, 06 九月 2024 15:40:18 +0800 Subject: [PATCH] 装机拆机功能 --- jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java | 1 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/devrent/DevRentMapper.java | 35 +++ jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentRespVO.java | 59 ++++++ jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentService.java | 56 ++++++ jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentPageReqVO.java | 51 +++++ jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSaveReqVO.java | 46 +++++ jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devrent/DevRentDO.java | 69 +++++++ sql/mysql/jh.sql | 4 jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java | 95 ++++++++++ jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java | 75 ++++++++ jh-module-ecg/jh-module-ecg-biz/src/main/resources/mapper/devrent/DevRentMapper.xml | 12 + 11 files changed, 502 insertions(+), 1 deletions(-) diff --git a/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java b/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java index e7ceaf4..dca119d 100644 --- a/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java +++ b/jh-module-ecg/jh-module-ecg-api/src/main/java/cn/lihu/jh/module/ecg/enums/ErrorCodeConstants.java @@ -25,4 +25,5 @@ ErrorCode DEV_MODEL_NOT_EXISTS = new ErrorCode(1_010_005_000, "璁惧鍨嬪彿涓嶅瓨鍦�"); ErrorCode DEVICE_NOT_EXISTS = new ErrorCode(1_010_005_001, "璁惧涓嶅瓨鍦�"); + ErrorCode DEV_RENT_NOT_EXISTS = new ErrorCode(1_010_005_002, "绉熷�熶笉瀛樺湪"); } diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java new file mode 100644 index 0000000..bd79b4f --- /dev/null +++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/DevRentController.java @@ -0,0 +1,95 @@ +package cn.lihu.jh.module.ecg.controller.admin.devrent; + +import org.springframework.web.bind.annotation.*; +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 java.util.*; +import java.io.IOException; + +import cn.lihu.jh.framework.common.pojo.PageParam; +import cn.lihu.jh.framework.common.pojo.PageResult; +import cn.lihu.jh.framework.common.pojo.CommonResult; +import cn.lihu.jh.framework.common.util.object.BeanUtils; +import static cn.lihu.jh.framework.common.pojo.CommonResult.success; + +import cn.lihu.jh.framework.excel.core.util.ExcelUtils; + +import cn.lihu.jh.framework.apilog.core.annotation.ApiAccessLog; +import static cn.lihu.jh.framework.apilog.core.enums.OperateTypeEnum.*; + +import cn.lihu.jh.module.ecg.controller.admin.devrent.vo.*; +import cn.lihu.jh.module.ecg.dal.dataobject.devrent.DevRentDO; +import cn.lihu.jh.module.ecg.service.devrent.DevRentService; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; + +@Tag(name = "绠$悊鍚庡彴 - 瑁呮満鎷嗘満") +@RestController +@RequestMapping("/ecg/dev-rent") +@Validated +public class DevRentController { + + @Resource + private DevRentService devRentService; + + @PostMapping("/create") + @Operation(summary = "鍒涘缓瑁呮満鎷嗘満") + @PreAuthorize("@ss.hasPermission('ecg:dev-rent:create')") + public CommonResult<Integer> createDevRent(@Valid @RequestBody DevRentSaveReqVO createReqVO) { + return success(devRentService.createDevRent(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "鏇存柊瑁呮満鎷嗘満") + @PreAuthorize("@ss.hasPermission('ecg:dev-rent:update')") + public CommonResult<Boolean> updateDevRent(@Valid @RequestBody DevRentSaveReqVO updateReqVO) { + devRentService.updateDevRent(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "鍒犻櫎瑁呮満鎷嗘満") + @Parameter(name = "id", description = "缂栧彿", required = true) + @PreAuthorize("@ss.hasPermission('ecg:dev-rent:delete')") + public CommonResult<Boolean> deleteDevRent(@RequestParam("id") Integer id) { + devRentService.deleteDevRent(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "鑾峰緱瑁呮満鎷嗘満") + @Parameter(name = "id", description = "缂栧彿", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('ecg:dev-rent:query')") + public CommonResult<DevRentRespVO> getDevRent(@RequestParam("id") Integer id) { + DevRentDO devRent = devRentService.getDevRent(id); + return success(BeanUtils.toBean(devRent, DevRentRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "鑾峰緱瑁呮満鎷嗘満鍒嗛〉") + @PreAuthorize("@ss.hasPermission('ecg:dev-rent:query')") + public CommonResult<PageResult<DevRentRespVO>> getDevRentPage(@Valid DevRentPageReqVO pageReqVO) { + PageResult<DevRentDO> pageResult = devRentService.getDevRentPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, DevRentRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "瀵煎嚭瑁呮満鎷嗘満 Excel") + @PreAuthorize("@ss.hasPermission('ecg:dev-rent:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportDevRentExcel(@Valid DevRentPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List<DevRentDO> list = devRentService.getDevRentPage(pageReqVO).getList(); + // 瀵煎嚭 Excel + ExcelUtils.write(response, "瑁呮満鎷嗘満.xls", "鏁版嵁", DevRentRespVO.class, + BeanUtils.toBean(list, DevRentRespVO.class)); + } + +} \ No newline at end of file diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentPageReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentPageReqVO.java new file mode 100644 index 0000000..e0f6798 --- /dev/null +++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentPageReqVO.java @@ -0,0 +1,51 @@ +package cn.lihu.jh.module.ecg.controller.admin.devrent.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.lihu.jh.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static cn.lihu.jh.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 DevRentPageReqVO extends PageParam { + + @Schema(description = "璁惧缂栧彿", example = "3986") + private String devId; + + @Schema(description = "鎮h�呯紪鍙�", example = "4973") + private String patId; + + @Schema(description = "鎮h�呭悕绉�", example = "鑺嬭壙") + private String patName; + + @Schema(description = "瑁呮満鏃堕棿") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] rentTime; + + @Schema(description = "鎷嗘満鏃堕棿") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] returnTime; + + @Schema(description = "骞叉壈鏁�") + private Integer interference; + + @Schema(description = "鍩虹嚎绮�") + private String baseline; + + @Schema(description = "鑴辩") + private String detachment; + + @Schema(description = "澶囨敞", example = "浣犵寽") + private String remark; + + @Schema(description = "鍒涘缓鏃堕棿") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentRespVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentRespVO.java new file mode 100644 index 0000000..4099444 --- /dev/null +++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentRespVO.java @@ -0,0 +1,59 @@ +package cn.lihu.jh.module.ecg.controller.admin.devrent.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.*; + +@Schema(description = "绠$悊鍚庡彴 - 瑁呮満鎷嗘満 Response VO") +@Data +@ExcelIgnoreUnannotated +public class DevRentRespVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "26525") + @ExcelProperty("id") + private Integer id; + + @Schema(description = "璁惧缂栧彿", requiredMode = Schema.RequiredMode.REQUIRED, example = "3986") + @ExcelProperty("璁惧缂栧彿") + private String devId; + + @Schema(description = "鎮h�呯紪鍙�", requiredMode = Schema.RequiredMode.REQUIRED, example = "4973") + @ExcelProperty("鎮h�呯紪鍙�") + private String patId; + + @Schema(description = "鎮h�呭悕绉�", requiredMode = Schema.RequiredMode.REQUIRED, example = "鑺嬭壙") + @ExcelProperty("鎮h�呭悕绉�") + private String patName; + + @Schema(description = "瑁呮満鏃堕棿") + @ExcelProperty("瑁呮満鏃堕棿") + private LocalDateTime rentTime; + + @Schema(description = "鎷嗘満鏃堕棿") + @ExcelProperty("鎷嗘満鏃堕棿") + private LocalDateTime returnTime; + + @Schema(description = "骞叉壈鏁�") + @ExcelProperty("骞叉壈鏁�") + private Integer interference; + + @Schema(description = "鍩虹嚎绮�") + @ExcelProperty("鍩虹嚎绮�") + private String baseline; + + @Schema(description = "鑴辩") + @ExcelProperty("鑴辩") + private String detachment; + + @Schema(description = "澶囨敞", example = "浣犵寽") + @ExcelProperty("澶囨敞") + private String remark; + + @Schema(description = "鍒涘缓鏃堕棿", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("鍒涘缓鏃堕棿") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSaveReqVO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSaveReqVO.java new file mode 100644 index 0000000..7e0b981 --- /dev/null +++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/devrent/vo/DevRentSaveReqVO.java @@ -0,0 +1,46 @@ +package cn.lihu.jh.module.ecg.controller.admin.devrent.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import javax.validation.constraints.NotEmpty; +import java.time.LocalDateTime; + +@Schema(description = "绠$悊鍚庡彴 - 瑁呮満鎷嗘満鏂板/淇敼 Request VO") +@Data +public class DevRentSaveReqVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "26525") + private Integer id; + + @Schema(description = "璁惧缂栧彿", requiredMode = Schema.RequiredMode.REQUIRED, example = "3986") + @NotEmpty(message = "璁惧缂栧彿涓嶈兘涓虹┖") + private String devId; + + @Schema(description = "鎮h�呯紪鍙�", requiredMode = Schema.RequiredMode.REQUIRED, example = "4973") + @NotEmpty(message = "鎮h�呯紪鍙蜂笉鑳戒负绌�") + private String patId; + + @Schema(description = "鎮h�呭悕绉�", requiredMode = Schema.RequiredMode.REQUIRED, example = "鑺嬭壙") + @NotEmpty(message = "鎮h�呭悕绉颁笉鑳戒负绌�") + private String patName; + + @Schema(description = "瑁呮満鏃堕棿") + private LocalDateTime rentTime; + + @Schema(description = "鎷嗘満鏃堕棿") + private LocalDateTime returnTime; + + @Schema(description = "骞叉壈鏁�") + private Integer interference; + + @Schema(description = "鍩虹嚎绮�") + private String baseline; + + @Schema(description = "鑴辩") + private String detachment; + + @Schema(description = "澶囨敞", example = "浣犵寽") + private String remark; + +} \ No newline at end of file diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devrent/DevRentDO.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devrent/DevRentDO.java new file mode 100644 index 0000000..718bda3 --- /dev/null +++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/dataobject/devrent/DevRentDO.java @@ -0,0 +1,69 @@ +package cn.lihu.jh.module.ecg.dal.dataobject.devrent; + +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.*; +import cn.lihu.jh.framework.mybatis.core.dataobject.BaseDO; + +/** + * 瑁呮満鎷嗘満 DO + * + * @author 鑺嬮亾婧愮爜 + */ +@TableName("dev_rent") +@KeySequence("dev_rent_seq") // 鐢ㄤ簬 Oracle銆丳ostgreSQL銆並ingbase銆丏B2銆丠2 鏁版嵁搴撶殑涓婚敭鑷銆傚鏋滄槸 MySQL 绛夋暟鎹簱锛屽彲涓嶅啓銆� +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class DevRentDO extends BaseDO { + + /** + * id + */ + @TableId + private Integer id; + /** + * 璁惧缂栧彿 + */ + private String devId; + /** + * 鎮h�呯紪鍙� + */ + private String patId; + /** + * 鎮h�呭悕绉� + */ + private String patName; + /** + * 瑁呮満鏃堕棿 + */ + private LocalDateTime rentTime; + /** + * 鎷嗘満鏃堕棿 + */ + private LocalDateTime returnTime; + /** + * 骞叉壈鏁� + */ + private Integer interference; + /** + * 鍩虹嚎绮� + */ + private String baseline; + /** + * 鑴辩 + */ + private String detachment; + /** + * 澶囨敞 + */ + private String remark; + +} \ No newline at end of file diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/devrent/DevRentMapper.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/devrent/DevRentMapper.java new file mode 100644 index 0000000..b0a998f --- /dev/null +++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/dal/mysql/devrent/DevRentMapper.java @@ -0,0 +1,35 @@ +package cn.lihu.jh.module.ecg.dal.mysql.devrent; + +import java.util.*; + +import cn.lihu.jh.framework.common.pojo.PageResult; +import cn.lihu.jh.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.lihu.jh.framework.mybatis.core.mapper.BaseMapperX; +import cn.lihu.jh.module.ecg.dal.dataobject.devrent.DevRentDO; +import org.apache.ibatis.annotations.Mapper; +import cn.lihu.jh.module.ecg.controller.admin.devrent.vo.*; + +/** + * 瑁呮満鎷嗘満 Mapper + * + * @author 鑺嬮亾婧愮爜 + */ +@Mapper +public interface DevRentMapper extends BaseMapperX<DevRentDO> { + + default PageResult<DevRentDO> selectPage(DevRentPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX<DevRentDO>() + .eqIfPresent(DevRentDO::getDevId, reqVO.getDevId()) + .eqIfPresent(DevRentDO::getPatId, reqVO.getPatId()) + .likeIfPresent(DevRentDO::getPatName, reqVO.getPatName()) + .betweenIfPresent(DevRentDO::getRentTime, reqVO.getRentTime()) + .betweenIfPresent(DevRentDO::getReturnTime, reqVO.getReturnTime()) + .eqIfPresent(DevRentDO::getInterference, reqVO.getInterference()) + .eqIfPresent(DevRentDO::getBaseline, reqVO.getBaseline()) + .eqIfPresent(DevRentDO::getDetachment, reqVO.getDetachment()) + .eqIfPresent(DevRentDO::getRemark, reqVO.getRemark()) + .betweenIfPresent(DevRentDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(DevRentDO::getId)); + } + +} \ No newline at end of file diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentService.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentService.java new file mode 100644 index 0000000..0d6d562 --- /dev/null +++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentService.java @@ -0,0 +1,56 @@ +package cn.lihu.jh.module.ecg.service.devrent; + +import java.util.*; +import cn.lihu.jh.module.ecg.controller.admin.devrent.vo.*; +import cn.lihu.jh.module.ecg.dal.dataobject.devrent.DevRentDO; +import cn.lihu.jh.framework.common.pojo.PageResult; +import cn.lihu.jh.framework.common.pojo.PageParam; + +import javax.validation.Valid; + +/** + * 瑁呮満鎷嗘満 Service 鎺ュ彛 + * + * @author 鑺嬮亾婧愮爜 + */ +public interface DevRentService { + + /** + * 鍒涘缓瑁呮満鎷嗘満 + * + * @param createReqVO 鍒涘缓淇℃伅 + * @return 缂栧彿 + */ + Integer createDevRent(@Valid DevRentSaveReqVO createReqVO); + + /** + * 鏇存柊瑁呮満鎷嗘満 + * + * @param updateReqVO 鏇存柊淇℃伅 + */ + void updateDevRent(@Valid DevRentSaveReqVO updateReqVO); + + /** + * 鍒犻櫎瑁呮満鎷嗘満 + * + * @param id 缂栧彿 + */ + void deleteDevRent(Integer id); + + /** + * 鑾峰緱瑁呮満鎷嗘満 + * + * @param id 缂栧彿 + * @return 瑁呮満鎷嗘満 + */ + DevRentDO getDevRent(Integer id); + + /** + * 鑾峰緱瑁呮満鎷嗘満鍒嗛〉 + * + * @param pageReqVO 鍒嗛〉鏌ヨ + * @return 瑁呮満鎷嗘満鍒嗛〉 + */ + PageResult<DevRentDO> getDevRentPage(DevRentPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java new file mode 100644 index 0000000..a7b6021 --- /dev/null +++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/devrent/DevRentServiceImpl.java @@ -0,0 +1,75 @@ +package cn.lihu.jh.module.ecg.service.devrent; + +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import cn.lihu.jh.module.ecg.controller.admin.devrent.vo.*; +import cn.lihu.jh.module.ecg.dal.dataobject.devrent.DevRentDO; +import cn.lihu.jh.framework.common.pojo.PageResult; +import cn.lihu.jh.framework.common.pojo.PageParam; +import cn.lihu.jh.framework.common.util.object.BeanUtils; + +import cn.lihu.jh.module.ecg.dal.mysql.devrent.DevRentMapper; + +import javax.annotation.Resource; + +import static cn.lihu.jh.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.*; + +/** + * 瑁呮満鎷嗘満 Service 瀹炵幇绫� + * + * @author 鑺嬮亾婧愮爜 + */ +@Service +@Validated +public class DevRentServiceImpl implements DevRentService { + + @Resource + private DevRentMapper devRentMapper; + + @Override + public Integer createDevRent(DevRentSaveReqVO createReqVO) { + // 鎻掑叆 + DevRentDO devRent = BeanUtils.toBean(createReqVO, DevRentDO.class); + devRentMapper.insert(devRent); + // 杩斿洖 + return devRent.getId(); + } + + @Override + public void updateDevRent(DevRentSaveReqVO updateReqVO) { + // 鏍¢獙瀛樺湪 + validateDevRentExists(updateReqVO.getId()); + // 鏇存柊 + DevRentDO updateObj = BeanUtils.toBean(updateReqVO, DevRentDO.class); + devRentMapper.updateById(updateObj); + } + + @Override + public void deleteDevRent(Integer id) { + // 鏍¢獙瀛樺湪 + validateDevRentExists(id); + // 鍒犻櫎 + devRentMapper.deleteById(id); + } + + private void validateDevRentExists(Integer id) { + if (devRentMapper.selectById(id) == null) { + throw exception(DEV_RENT_NOT_EXISTS); + } + } + + @Override + public DevRentDO getDevRent(Integer id) { + return devRentMapper.selectById(id); + } + + @Override + public PageResult<DevRentDO> getDevRentPage(DevRentPageReqVO pageReqVO) { + return devRentMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/resources/mapper/devrent/DevRentMapper.xml b/jh-module-ecg/jh-module-ecg-biz/src/main/resources/mapper/devrent/DevRentMapper.xml new file mode 100644 index 0000000..0dcc0be --- /dev/null +++ b/jh-module-ecg/jh-module-ecg-biz/src/main/resources/mapper/devrent/DevRentMapper.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="cn.lihu.jh.module.ecg.dal.mysql.devrent.DevRentMapper"> + + <!-- + 涓�鑸儏鍐典笅锛屽敖鍙兘浣跨敤 Mapper 杩涜 CRUD 澧炲垹鏀规煡鍗冲彲銆� + 鏃犳硶婊¤冻鐨勫満鏅紝渚嬪璇村琛ㄥ叧鑱旀煡璇紝鎵嶄娇鐢� XML 缂栧啓 SQL銆� + 浠g爜鐢熸垚鍣ㄦ殏鏃跺彧鐢熸垚 Mapper XML 鏂囦欢鏈韩锛屾洿澶氭帹鑽� MybatisX 蹇�熷紑鍙戞彃浠舵潵鐢熸垚鏌ヨ銆� + 鏂囨。鍙锛歨ttps://www.iocoder.cn/MyBatis/x-plugins/ + --> + +</mapper> \ No newline at end of file diff --git a/sql/mysql/jh.sql b/sql/mysql/jh.sql index 307195d..dfcb821 100644 --- a/sql/mysql/jh.sql +++ b/sql/mysql/jh.sql @@ -151,9 +151,11 @@ `detachment` varchar(100) DEFAULT NULL COMMENT '鑴辩', `remark` varchar(100) DEFAULT NULL COMMENT '澶囨敞', `tenant_id` int DEFAULT 1 COMMENT '绉熸埛缂栧彿', + `creator` varchar(10) DEFAULT '' COMMENT '鍒涘缓鑰�', `create_time` datetime NOT NULL COMMENT '鍒涘缓鏃堕棿', + `updater` varchar(10) DEFAULT '' COMMENT '鏇存柊鑰�', `update_time` datetime NOT NULL COMMENT '鏇存柊鏃堕棿', - `deleted` bit(1) DEFAULT 0, + `deleted` bit(1) DEFAULT 0 COMMENT '鍒犻櫎鏍囪', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='瑁呮満鎷嗘満琛�'; -- Gitblit v1.9.3