档案借阅申请
parent
b210fff383
commit
c4bb8252a8
@ -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<Integer> createBorrowApply(@Valid @RequestBody BorrowApplyCreateReqVO createReqVO) {
|
||||
return success(borrowApplyService.createBorrowApply(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新档案借阅申请")
|
||||
@PreAuthorize("@ss.hasPermission('archives:borrow-apply:update')")
|
||||
public CommonResult<Boolean> 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<Boolean> 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<BorrowApplyRespVO> 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<List<BorrowApplyRespVO>> getBorrowApplyList(@RequestParam("ids") Collection<Integer> ids) {
|
||||
List<BorrowApplyDO> list = borrowApplyService.getBorrowApplyList(ids);
|
||||
return success(BorrowApplyConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得档案借阅申请分页")
|
||||
@PreAuthorize("@ss.hasPermission('archives:borrow-apply:query')")
|
||||
public CommonResult<PageResult<BorrowApplyRespVO>> getBorrowApplyPage(@Valid BorrowApplyPageReqVO pageVO) {
|
||||
PageResult<BorrowApplyDO> 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<BorrowApplyDO> list = borrowApplyService.getBorrowApplyList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<BorrowApplyExcelVO> datas = BorrowApplyConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "档案借阅申请.xls", "数据", BorrowApplyExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@ -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 {
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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<BorrowApplyRespVO> convertList(List<BorrowApplyDO> list);
|
||||
|
||||
PageResult<BorrowApplyRespVO> convertPage(PageResult<BorrowApplyDO> page);
|
||||
|
||||
List<BorrowApplyExcelVO> convertList02(List<BorrowApplyDO> list);
|
||||
|
||||
}
|
@ -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;
|
||||
|
||||
}
|
@ -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<BorrowApplyDO> {
|
||||
|
||||
default PageResult<BorrowApplyDO> selectPage(BorrowApplyPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<BorrowApplyDO>()
|
||||
.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<BorrowApplyDO> selectList(BorrowApplyExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<BorrowApplyDO>()
|
||||
.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));
|
||||
}
|
||||
|
||||
}
|
@ -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<BorrowApplyDO> getBorrowApplyList(Collection<Integer> ids);
|
||||
|
||||
/**
|
||||
* 获得档案借阅申请分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 档案借阅申请分页
|
||||
*/
|
||||
PageResult<BorrowApplyDO> getBorrowApplyPage(BorrowApplyPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得档案借阅申请列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 档案借阅申请列表
|
||||
*/
|
||||
List<BorrowApplyDO> getBorrowApplyList(BorrowApplyExportReqVO exportReqVO);
|
||||
|
||||
}
|
@ -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<BorrowApplyDO> getBorrowApplyList(Collection<Integer> ids) {
|
||||
return borrowApplyMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<BorrowApplyDO> getBorrowApplyPage(BorrowApplyPageReqVO pageReqVO) {
|
||||
return borrowApplyMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BorrowApplyDO> getBorrowApplyList(BorrowApplyExportReqVO exportReqVO) {
|
||||
return borrowApplyMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue