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 index f8d43673..b1036d77 100644 --- 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 @@ -48,9 +48,8 @@ public class BorrowApplyController { @PutMapping("/update") @Operation(summary = "更新档案借阅申请") @PreAuthorize("@ss.hasPermission('archives:borrow-apply:update')") - public CommonResult updateBorrowApply(@Valid @RequestBody BorrowApplyUpdateReqVO updateReqVO) { - borrowApplyService.updateBorrowApply(updateReqVO); - return success(true); + public CommonResult updateBorrowApply(@Valid @RequestBody BorrowApplyUpdateReqVO updateReqVO) { + return success(borrowApplyService.updateBorrowApply(updateReqVO); } @DeleteMapping("/delete") 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 index ea9acde1..4ebb4665 100644 --- 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 @@ -34,7 +34,7 @@ public interface BorrowApplyMapper extends BaseMapperX { .eqIfPresent(BorrowApplyDO::getRemark, reqVO.getRemark()) .betweenIfPresent(BorrowApplyDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(BorrowApplyDO::getId) - .eq(BorrowApplyDO::getBorrowState,"1")); + .isNull(BorrowApplyDO::getBorrowState)); } @@ -55,7 +55,7 @@ public interface BorrowApplyMapper extends BaseMapperX { .eqIfPresent(BorrowApplyDO::getRemark, reqVO.getRemark()) .betweenIfPresent(BorrowApplyDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(BorrowApplyDO::getId) - .isNull(BorrowApplyDO::getBorrowState)); + .in(BorrowApplyDO::getBorrowState,"0","1","2")); } 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 index 70bd5225..1ec482f7 100644 --- 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 @@ -28,7 +28,7 @@ public interface BorrowApplyService { * * @param updateReqVO 更新信息 */ - void updateBorrowApply(@Valid BorrowApplyUpdateReqVO updateReqVO); + CommonResult updateBorrowApply(@Valid BorrowApplyUpdateReqVO updateReqVO); /** * 删除档案借阅申请 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 index 9a765af6..0d5e5399 100644 --- 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 @@ -50,7 +50,6 @@ public class BorrowApplyServiceImpl implements BorrowApplyService { } RecordUpdateReqVO recordUpdateReqVO = new RecordUpdateReqVO(); BeanUtils.copyProperties(record,recordUpdateReqVO); - recordUpdateReqVO.setBorrowStatus("1"); recordService.updateRecord(recordUpdateReqVO); borrowApplyMapper.insert(borrowApply); // 返回 @@ -59,7 +58,7 @@ public class BorrowApplyServiceImpl implements BorrowApplyService { @Override @Transactional - public void updateBorrowApply(BorrowApplyUpdateReqVO updateReqVO) { + public CommonResult updateBorrowApply(BorrowApplyUpdateReqVO updateReqVO) { BorrowApplyDO borrowApply = this.getBorrowApply(updateReqVO.getId()); RecordUpdateReqVO recordUpdateReqVO = new RecordUpdateReqVO(); @@ -68,9 +67,13 @@ public class BorrowApplyServiceImpl implements BorrowApplyService { BeanUtils.copyProperties(record,recordUpdateReqVO); if (StringUtils.isNotNull(updateReqVO.getBorrowState())){ + if (record.getBorrowStatus().equals("0")){ + return CommonResult.error("档案已被借阅"); + } if (updateReqVO.getBorrowState().equals("2")) { recordUpdateReqVO.setBorrowStatus(null); } + recordUpdateReqVO.setBorrowStatus(updateReqVO.getBorrowState()); recordService.updateRecord(recordUpdateReqVO); } @@ -79,6 +82,7 @@ public class BorrowApplyServiceImpl implements BorrowApplyService { // 更新 BorrowApplyDO updateObj = BorrowApplyConvert.INSTANCE.convert(updateReqVO); borrowApplyMapper.updateById(updateObj); + return CommonResult.success("成功"); } @Override