diff --git a/yudao-module-archives/yudao-module-archives-api/src/main/java/cn/iocoder/yudao/module/archives/enums/ErrorCodeConstants.java b/yudao-module-archives/yudao-module-archives-api/src/main/java/cn/iocoder/yudao/module/archives/enums/ErrorCodeConstants.java index 300ab79d..6746d127 100644 --- a/yudao-module-archives/yudao-module-archives-api/src/main/java/cn/iocoder/yudao/module/archives/enums/ErrorCodeConstants.java +++ b/yudao-module-archives/yudao-module-archives-api/src/main/java/cn/iocoder/yudao/module/archives/enums/ErrorCodeConstants.java @@ -4,4 +4,6 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode; public interface ErrorCodeConstants { ErrorCode RECORD_NOT_EXISTS = new ErrorCode(200100, "归档不存在"); ErrorCode CODE_RULE_NOT_EXISTS = new ErrorCode(300100, "编码不存在"); + + ErrorCode BORROW_APPLY_NOT_EXISTS = new ErrorCode(300200,"借阅申请不存在"); } \ No newline at end of file diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/BorrowApplyController.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/BorrowApplyController.java new file mode 100644 index 00000000..d9bd04f8 --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/BorrowApplyController.java @@ -0,0 +1,102 @@ +package cn.iocoder.yudao.module.archives.controller.admin.borrowapply; + +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.PageResult; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; + +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*; + +import cn.iocoder.yudao.module.archives.controller.admin.borrowapply.vo.*; +import cn.iocoder.yudao.module.archives.dal.dataobject.borrowapply.BorrowApplyDO; +import cn.iocoder.yudao.module.archives.convert.borrowapply.BorrowApplyConvert; +import cn.iocoder.yudao.module.archives.service.borrowapply.BorrowApplyService; + +@Tag(name = "管理后台 - 档案借阅申请") +@RestController +@RequestMapping("/archives/borrow-apply") +@Validated +public class BorrowApplyController { + + @Resource + private BorrowApplyService borrowApplyService; + + @PostMapping("/create") + @Operation(summary = "创建档案借阅申请") + @PreAuthorize("@ss.hasPermission('archives:borrow-apply:create')") + public CommonResult createBorrowApply(@Valid @RequestBody BorrowApplyCreateReqVO createReqVO) { + return success(borrowApplyService.createBorrowApply(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新档案借阅申请") + @PreAuthorize("@ss.hasPermission('archives:borrow-apply:update')") + public CommonResult updateBorrowApply(@Valid @RequestBody BorrowApplyUpdateReqVO updateReqVO) { + borrowApplyService.updateBorrowApply(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除档案借阅申请") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('archives:borrow-apply:delete')") + public CommonResult deleteBorrowApply(@RequestParam("id") Integer id) { + borrowApplyService.deleteBorrowApply(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得档案借阅申请") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('archives:borrow-apply:query')") + public CommonResult getBorrowApply(@RequestParam("id") Integer id) { + BorrowApplyDO borrowApply = borrowApplyService.getBorrowApply(id); + return success(BorrowApplyConvert.INSTANCE.convert(borrowApply)); + } + + @GetMapping("/list") + @Operation(summary = "获得档案借阅申请列表") + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") + @PreAuthorize("@ss.hasPermission('archives:borrow-apply:query')") + public CommonResult> getBorrowApplyList(@RequestParam("ids") Collection ids) { + List list = borrowApplyService.getBorrowApplyList(ids); + return success(BorrowApplyConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @Operation(summary = "获得档案借阅申请分页") + @PreAuthorize("@ss.hasPermission('archives:borrow-apply:query')") + public CommonResult> getBorrowApplyPage(@Valid BorrowApplyPageReqVO pageVO) { + PageResult pageResult = borrowApplyService.getBorrowApplyPage(pageVO); + return success(BorrowApplyConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出档案借阅申请 Excel") + @PreAuthorize("@ss.hasPermission('archives:borrow-apply:export')") + @OperateLog(type = EXPORT) + public void exportBorrowApplyExcel(@Valid BorrowApplyExportReqVO exportReqVO, + HttpServletResponse response) throws IOException { + List list = borrowApplyService.getBorrowApplyList(exportReqVO); + // 导出 Excel + List datas = BorrowApplyConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "档案借阅申请.xls", "数据", BorrowApplyExcelVO.class, datas); + } + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyBaseVO.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyBaseVO.java new file mode 100644 index 00000000..8a37a66f --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyBaseVO.java @@ -0,0 +1,64 @@ +package cn.iocoder.yudao.module.archives.controller.admin.borrowapply.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import javax.validation.constraints.*; +import org.springframework.format.annotation.DateTimeFormat; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +/** + * 档案借阅申请 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class BorrowApplyBaseVO { + + @Schema(description = "借阅申请编码") + private String borrowCode; + + @Schema(description = "借阅申请状态 0:已通过 1驳回") + private Boolean borrowState; + + @Schema(description = "借阅事由", example = "不好") + private String reason; + + @Schema(description = "借阅描述") + private String describe; + + @Schema(description = "借阅人id", example = "6652") + private Integer userId; + + @Schema(description = "借阅人名称", example = "李四") + private String userName; + + @Schema(description = "借阅部门id", example = "29611") + private Integer deptId; + + @Schema(description = "借阅部门名称", example = "张三") + private String deptName; + + @Schema(description = "预计归还日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime returnTime; + + @Schema(description = "借阅方式 0:外接 1:现场查阅") + private Boolean way; + + @Schema(description = "档案介质") + private Boolean media; + + @Schema(description = "业务实体id", example = "23211") + private Long companyId; + + @Schema(description = "业务实体名称") + private String company; + + @Schema(description = "描述", example = "随便") + private String remark; + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyCreateReqVO.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyCreateReqVO.java new file mode 100644 index 00000000..a397da6c --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyCreateReqVO.java @@ -0,0 +1,14 @@ +package cn.iocoder.yudao.module.archives.controller.admin.borrowapply.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 档案借阅申请创建 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class BorrowApplyCreateReqVO extends BorrowApplyBaseVO { + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyExcelVO.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyExcelVO.java new file mode 100644 index 00000000..5d46dc93 --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyExcelVO.java @@ -0,0 +1,68 @@ +package cn.iocoder.yudao.module.archives.controller.admin.borrowapply.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import java.time.LocalDateTime; +import java.time.LocalDateTime; +import java.time.LocalDateTime; + +import com.alibaba.excel.annotation.ExcelProperty; + +/** + * 档案借阅申请 Excel VO + * + * @author 芋道源码 + */ +@Data +public class BorrowApplyExcelVO { + + @ExcelProperty("借阅id") + private Integer id; + + @ExcelProperty("借阅申请编码") + private String borrowCode; + + @ExcelProperty("借阅申请状态 0:已通过 1驳回") + private Boolean borrowState; + + @ExcelProperty("借阅事由") + private String reason; + + @ExcelProperty("借阅描述") + private String describe; + + @ExcelProperty("借阅人id") + private Integer userId; + + @ExcelProperty("借阅人名称") + private String userName; + + @ExcelProperty("借阅部门id") + private Integer deptId; + + @ExcelProperty("借阅部门名称") + private String deptName; + + @ExcelProperty("预计归还日期") + private LocalDateTime returnTime; + + @ExcelProperty("借阅方式 0:外接 1:现场查阅") + private Boolean way; + + @ExcelProperty("档案介质") + private Boolean media; + + @ExcelProperty("业务实体id") + private Long companyId; + + @ExcelProperty("业务实体名称") + private String company; + + @ExcelProperty("描述") + private String remark; + + @ExcelProperty("创建日期") + private LocalDateTime createTime; + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyExportReqVO.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyExportReqVO.java new file mode 100644 index 00000000..726eb9b4 --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyExportReqVO.java @@ -0,0 +1,63 @@ +package cn.iocoder.yudao.module.archives.controller.admin.borrowapply.vo; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import java.time.LocalDateTime; +import org.springframework.format.annotation.DateTimeFormat; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 档案借阅申请 Excel 导出 Request VO,参数和 BorrowApplyPageReqVO 是一致的") +@Data +public class BorrowApplyExportReqVO { + + @Schema(description = "借阅申请编码") + private String borrowCode; + + @Schema(description = "借阅申请状态 0:已通过 1驳回") + private Boolean borrowState; + + @Schema(description = "借阅事由", example = "不好") + private String reason; + + @Schema(description = "借阅描述") + private String describe; + + @Schema(description = "借阅人id", example = "6652") + private Integer userId; + + @Schema(description = "借阅人名称", example = "李四") + private String userName; + + @Schema(description = "借阅部门id", example = "29611") + private Integer deptId; + + @Schema(description = "借阅部门名称", example = "张三") + private String deptName; + + @Schema(description = "预计归还日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] returnTime; + + @Schema(description = "借阅方式 0:外接 1:现场查阅") + private Boolean way; + + @Schema(description = "档案介质") + private Boolean media; + + @Schema(description = "业务实体id", example = "23211") + private Long companyId; + + @Schema(description = "业务实体名称") + private String company; + + @Schema(description = "描述", example = "随便") + private String remark; + + @Schema(description = "创建日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyPageReqVO.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyPageReqVO.java new file mode 100644 index 00000000..19c97871 --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyPageReqVO.java @@ -0,0 +1,65 @@ +package cn.iocoder.yudao.module.archives.controller.admin.borrowapply.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 BorrowApplyPageReqVO extends PageParam { + + @Schema(description = "借阅申请编码") + private String borrowCode; + + @Schema(description = "借阅申请状态 0:已通过 1驳回") + private Boolean borrowState; + + @Schema(description = "借阅事由", example = "不好") + private String reason; + + @Schema(description = "借阅描述") + private String describe; + + @Schema(description = "借阅人id", example = "6652") + private Integer userId; + + @Schema(description = "借阅人名称", example = "李四") + private String userName; + + @Schema(description = "借阅部门id", example = "29611") + private Integer deptId; + + @Schema(description = "借阅部门名称", example = "张三") + private String deptName; + + @Schema(description = "预计归还日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] returnTime; + + @Schema(description = "借阅方式 0:外接 1:现场查阅") + private Boolean way; + + @Schema(description = "档案介质") + private Boolean media; + + @Schema(description = "业务实体id", example = "23211") + private Long companyId; + + @Schema(description = "业务实体名称") + private String company; + + @Schema(description = "描述", example = "随便") + private String remark; + + @Schema(description = "创建日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyRespVO.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyRespVO.java new file mode 100644 index 00000000..81ad9e77 --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyRespVO.java @@ -0,0 +1,19 @@ +package cn.iocoder.yudao.module.archives.controller.admin.borrowapply.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 档案借阅申请 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class BorrowApplyRespVO extends BorrowApplyBaseVO { + + @Schema(description = "借阅id", requiredMode = Schema.RequiredMode.REQUIRED, example = "8595") + private Integer id; + + @Schema(description = "创建日期") + private LocalDateTime createTime; + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyUpdateReqVO.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyUpdateReqVO.java new file mode 100644 index 00000000..37f347a0 --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/controller/admin/borrowapply/vo/BorrowApplyUpdateReqVO.java @@ -0,0 +1,18 @@ +package cn.iocoder.yudao.module.archives.controller.admin.borrowapply.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; +import java.util.*; +import javax.validation.constraints.*; + +@Schema(description = "管理后台 - 档案借阅申请更新 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class BorrowApplyUpdateReqVO extends BorrowApplyBaseVO { + + @Schema(description = "借阅id", requiredMode = Schema.RequiredMode.REQUIRED, example = "8595") + @NotNull(message = "借阅id不能为空") + private Integer id; + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/convert/borrowapply/BorrowApplyConvert.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/convert/borrowapply/BorrowApplyConvert.java new file mode 100644 index 00000000..e6c34376 --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/convert/borrowapply/BorrowApplyConvert.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.archives.convert.borrowapply; + +import java.util.*; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; +import cn.iocoder.yudao.module.archives.controller.admin.borrowapply.vo.*; +import cn.iocoder.yudao.module.archives.dal.dataobject.borrowapply.BorrowApplyDO; + +/** + * 档案借阅申请 Convert + * + * @author 芋道源码 + */ +@Mapper +public interface BorrowApplyConvert { + + BorrowApplyConvert INSTANCE = Mappers.getMapper(BorrowApplyConvert.class); + + BorrowApplyDO convert(BorrowApplyCreateReqVO bean); + + BorrowApplyDO convert(BorrowApplyUpdateReqVO bean); + + BorrowApplyRespVO convert(BorrowApplyDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/dal/dataobject/borrowapply/BorrowApplyDO.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/dal/dataobject/borrowapply/BorrowApplyDO.java new file mode 100644 index 00000000..e7035160 --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/dal/dataobject/borrowapply/BorrowApplyDO.java @@ -0,0 +1,88 @@ +package cn.iocoder.yudao.module.archives.dal.dataobject.borrowapply; + +import lombok.*; +import java.util.*; +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("archives_borrow_apply") +@KeySequence("archives_borrow_apply_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class BorrowApplyDO extends BaseDO { + + /** + * 借阅id + */ + @TableId + private Integer id; + /** + * 借阅申请编码 + */ + private String borrowCode; + /** + * 借阅申请状态 0:已通过 1驳回 + */ + private Boolean borrowState; + /** + * 借阅事由 + */ + private String reason; + /** + * 借阅描述 + */ + private String describe; + /** + * 借阅人id + */ + private Integer userId; + /** + * 借阅人名称 + */ + private String userName; + /** + * 借阅部门id + */ + private Integer deptId; + /** + * 借阅部门名称 + */ + private String deptName; + /** + * 预计归还日期 + */ + private LocalDateTime returnTime; + /** + * 借阅方式 0:外接 1:现场查阅 + */ + private Boolean way; + /** + * 档案介质 + */ + private Boolean media; + /** + * 业务实体id + */ + private Long companyId; + /** + * 业务实体名称 + */ + private String company; + /** + * 描述 + */ + private String remark; + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/dal/mysql/borrowapply/BorrowApplyMapper.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/dal/mysql/borrowapply/BorrowApplyMapper.java new file mode 100644 index 00000000..c8c194d3 --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/dal/mysql/borrowapply/BorrowApplyMapper.java @@ -0,0 +1,60 @@ +package cn.iocoder.yudao.module.archives.dal.mysql.borrowapply; + +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.archives.dal.dataobject.borrowapply.BorrowApplyDO; +import org.apache.ibatis.annotations.Mapper; +import cn.iocoder.yudao.module.archives.controller.admin.borrowapply.vo.*; + +/** + * 档案借阅申请 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface BorrowApplyMapper extends BaseMapperX { + + default PageResult selectPage(BorrowApplyPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(BorrowApplyDO::getBorrowCode, reqVO.getBorrowCode()) + .eqIfPresent(BorrowApplyDO::getBorrowState, reqVO.getBorrowState()) + .eqIfPresent(BorrowApplyDO::getReason, reqVO.getReason()) + .eqIfPresent(BorrowApplyDO::getDescribe, reqVO.getDescribe()) + .eqIfPresent(BorrowApplyDO::getUserId, reqVO.getUserId()) + .likeIfPresent(BorrowApplyDO::getUserName, reqVO.getUserName()) + .eqIfPresent(BorrowApplyDO::getDeptId, reqVO.getDeptId()) + .likeIfPresent(BorrowApplyDO::getDeptName, reqVO.getDeptName()) + .betweenIfPresent(BorrowApplyDO::getReturnTime, reqVO.getReturnTime()) + .eqIfPresent(BorrowApplyDO::getWay, reqVO.getWay()) + .eqIfPresent(BorrowApplyDO::getMedia, reqVO.getMedia()) + .eqIfPresent(BorrowApplyDO::getCompanyId, reqVO.getCompanyId()) + .eqIfPresent(BorrowApplyDO::getCompany, reqVO.getCompany()) + .eqIfPresent(BorrowApplyDO::getRemark, reqVO.getRemark()) + .betweenIfPresent(BorrowApplyDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(BorrowApplyDO::getId)); + } + + default List selectList(BorrowApplyExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(BorrowApplyDO::getBorrowCode, reqVO.getBorrowCode()) + .eqIfPresent(BorrowApplyDO::getBorrowState, reqVO.getBorrowState()) + .eqIfPresent(BorrowApplyDO::getReason, reqVO.getReason()) + .eqIfPresent(BorrowApplyDO::getDescribe, reqVO.getDescribe()) + .eqIfPresent(BorrowApplyDO::getUserId, reqVO.getUserId()) + .likeIfPresent(BorrowApplyDO::getUserName, reqVO.getUserName()) + .eqIfPresent(BorrowApplyDO::getDeptId, reqVO.getDeptId()) + .likeIfPresent(BorrowApplyDO::getDeptName, reqVO.getDeptName()) + .betweenIfPresent(BorrowApplyDO::getReturnTime, reqVO.getReturnTime()) + .eqIfPresent(BorrowApplyDO::getWay, reqVO.getWay()) + .eqIfPresent(BorrowApplyDO::getMedia, reqVO.getMedia()) + .eqIfPresent(BorrowApplyDO::getCompanyId, reqVO.getCompanyId()) + .eqIfPresent(BorrowApplyDO::getCompany, reqVO.getCompany()) + .eqIfPresent(BorrowApplyDO::getRemark, reqVO.getRemark()) + .betweenIfPresent(BorrowApplyDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(BorrowApplyDO::getId)); + } + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/borrowapply/BorrowApplyService.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/borrowapply/BorrowApplyService.java new file mode 100644 index 00000000..9dbf38e8 --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/borrowapply/BorrowApplyService.java @@ -0,0 +1,70 @@ +package cn.iocoder.yudao.module.archives.service.borrowapply; + +import java.util.*; +import javax.validation.*; +import cn.iocoder.yudao.module.archives.controller.admin.borrowapply.vo.*; +import cn.iocoder.yudao.module.archives.dal.dataobject.borrowapply.BorrowApplyDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +/** + * 档案借阅申请 Service 接口 + * + * @author 芋道源码 + */ +public interface BorrowApplyService { + + /** + * 创建档案借阅申请 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Integer createBorrowApply(@Valid BorrowApplyCreateReqVO createReqVO); + + /** + * 更新档案借阅申请 + * + * @param updateReqVO 更新信息 + */ + void updateBorrowApply(@Valid BorrowApplyUpdateReqVO updateReqVO); + + /** + * 删除档案借阅申请 + * + * @param id 编号 + */ + void deleteBorrowApply(Integer id); + + /** + * 获得档案借阅申请 + * + * @param id 编号 + * @return 档案借阅申请 + */ + BorrowApplyDO getBorrowApply(Integer id); + + /** + * 获得档案借阅申请列表 + * + * @param ids 编号 + * @return 档案借阅申请列表 + */ + List getBorrowApplyList(Collection ids); + + /** + * 获得档案借阅申请分页 + * + * @param pageReqVO 分页查询 + * @return 档案借阅申请分页 + */ + PageResult getBorrowApplyPage(BorrowApplyPageReqVO pageReqVO); + + /** + * 获得档案借阅申请列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 档案借阅申请列表 + */ + List getBorrowApplyList(BorrowApplyExportReqVO exportReqVO); + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/borrowapply/BorrowApplyServiceImpl.java b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/borrowapply/BorrowApplyServiceImpl.java new file mode 100644 index 00000000..2e30f2bc --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/java/cn/iocoder/yudao/module/archives/service/borrowapply/BorrowApplyServiceImpl.java @@ -0,0 +1,82 @@ +package cn.iocoder.yudao.module.archives.service.borrowapply; + +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; + +import java.util.*; +import cn.iocoder.yudao.module.archives.controller.admin.borrowapply.vo.*; +import cn.iocoder.yudao.module.archives.dal.dataobject.borrowapply.BorrowApplyDO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; + +import cn.iocoder.yudao.module.archives.convert.borrowapply.BorrowApplyConvert; +import cn.iocoder.yudao.module.archives.dal.mysql.borrowapply.BorrowApplyMapper; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.archives.enums.ErrorCodeConstants.*; + +/** + * 档案借阅申请 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class BorrowApplyServiceImpl implements BorrowApplyService { + + @Resource + private BorrowApplyMapper borrowApplyMapper; + + @Override + public Integer createBorrowApply(BorrowApplyCreateReqVO createReqVO) { + // 插入 + BorrowApplyDO borrowApply = BorrowApplyConvert.INSTANCE.convert(createReqVO); + borrowApplyMapper.insert(borrowApply); + // 返回 + return borrowApply.getId(); + } + + @Override + public void updateBorrowApply(BorrowApplyUpdateReqVO updateReqVO) { + // 校验存在 + validateBorrowApplyExists(updateReqVO.getId()); + // 更新 + BorrowApplyDO updateObj = BorrowApplyConvert.INSTANCE.convert(updateReqVO); + borrowApplyMapper.updateById(updateObj); + } + + @Override + public void deleteBorrowApply(Integer id) { + // 校验存在 + validateBorrowApplyExists(id); + // 删除 + borrowApplyMapper.deleteById(id); + } + + private void validateBorrowApplyExists(Integer id) { + if (borrowApplyMapper.selectById(id) == null) { + throw exception(BORROW_APPLY_NOT_EXISTS); + } + } + + @Override + public BorrowApplyDO getBorrowApply(Integer id) { + return borrowApplyMapper.selectById(id); + } + + @Override + public List getBorrowApplyList(Collection ids) { + return borrowApplyMapper.selectBatchIds(ids); + } + + @Override + public PageResult getBorrowApplyPage(BorrowApplyPageReqVO pageReqVO) { + return borrowApplyMapper.selectPage(pageReqVO); + } + + @Override + public List getBorrowApplyList(BorrowApplyExportReqVO exportReqVO) { + return borrowApplyMapper.selectList(exportReqVO); + } + +} diff --git a/yudao-module-archives/yudao-module-archives-biz/src/main/resources/mapper/borrowapply/BorrowApplyMapper.xml b/yudao-module-archives/yudao-module-archives-biz/src/main/resources/mapper/borrowapply/BorrowApplyMapper.xml new file mode 100644 index 00000000..468705e1 --- /dev/null +++ b/yudao-module-archives/yudao-module-archives-biz/src/main/resources/mapper/borrowapply/BorrowApplyMapper.xml @@ -0,0 +1,12 @@ + + + + + + +