bug修复

new
parent 1424ecf52e
commit 48b265a850

@ -48,9 +48,8 @@ public class BorrowApplyController {
@PutMapping("/update") @PutMapping("/update")
@Operation(summary = "更新档案借阅申请") @Operation(summary = "更新档案借阅申请")
@PreAuthorize("@ss.hasPermission('archives:borrow-apply:update')") @PreAuthorize("@ss.hasPermission('archives:borrow-apply:update')")
public CommonResult<Boolean> updateBorrowApply(@Valid @RequestBody BorrowApplyUpdateReqVO updateReqVO) { public CommonResult<String> updateBorrowApply(@Valid @RequestBody BorrowApplyUpdateReqVO updateReqVO) {
borrowApplyService.updateBorrowApply(updateReqVO); return success(borrowApplyService.updateBorrowApply(updateReqVO);
return success(true);
} }
@DeleteMapping("/delete") @DeleteMapping("/delete")

@ -34,7 +34,7 @@ public interface BorrowApplyMapper extends BaseMapperX<BorrowApplyDO> {
.eqIfPresent(BorrowApplyDO::getRemark, reqVO.getRemark()) .eqIfPresent(BorrowApplyDO::getRemark, reqVO.getRemark())
.betweenIfPresent(BorrowApplyDO::getCreateTime, reqVO.getCreateTime()) .betweenIfPresent(BorrowApplyDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(BorrowApplyDO::getId) .orderByDesc(BorrowApplyDO::getId)
.eq(BorrowApplyDO::getBorrowState,"1")); .isNull(BorrowApplyDO::getBorrowState));
} }
@ -55,7 +55,7 @@ public interface BorrowApplyMapper extends BaseMapperX<BorrowApplyDO> {
.eqIfPresent(BorrowApplyDO::getRemark, reqVO.getRemark()) .eqIfPresent(BorrowApplyDO::getRemark, reqVO.getRemark())
.betweenIfPresent(BorrowApplyDO::getCreateTime, reqVO.getCreateTime()) .betweenIfPresent(BorrowApplyDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(BorrowApplyDO::getId) .orderByDesc(BorrowApplyDO::getId)
.isNull(BorrowApplyDO::getBorrowState)); .in(BorrowApplyDO::getBorrowState,"0","1","2"));
} }

@ -28,7 +28,7 @@ public interface BorrowApplyService {
* *
* @param updateReqVO * @param updateReqVO
*/ */
void updateBorrowApply(@Valid BorrowApplyUpdateReqVO updateReqVO); CommonResult<String> updateBorrowApply(@Valid BorrowApplyUpdateReqVO updateReqVO);
/** /**
* *

@ -50,7 +50,6 @@ public class BorrowApplyServiceImpl implements BorrowApplyService {
} }
RecordUpdateReqVO recordUpdateReqVO = new RecordUpdateReqVO(); RecordUpdateReqVO recordUpdateReqVO = new RecordUpdateReqVO();
BeanUtils.copyProperties(record,recordUpdateReqVO); BeanUtils.copyProperties(record,recordUpdateReqVO);
recordUpdateReqVO.setBorrowStatus("1");
recordService.updateRecord(recordUpdateReqVO); recordService.updateRecord(recordUpdateReqVO);
borrowApplyMapper.insert(borrowApply); borrowApplyMapper.insert(borrowApply);
// 返回 // 返回
@ -59,7 +58,7 @@ public class BorrowApplyServiceImpl implements BorrowApplyService {
@Override @Override
@Transactional @Transactional
public void updateBorrowApply(BorrowApplyUpdateReqVO updateReqVO) { public CommonResult<String> updateBorrowApply(BorrowApplyUpdateReqVO updateReqVO) {
BorrowApplyDO borrowApply = this.getBorrowApply(updateReqVO.getId()); BorrowApplyDO borrowApply = this.getBorrowApply(updateReqVO.getId());
RecordUpdateReqVO recordUpdateReqVO = new RecordUpdateReqVO(); RecordUpdateReqVO recordUpdateReqVO = new RecordUpdateReqVO();
@ -68,9 +67,13 @@ public class BorrowApplyServiceImpl implements BorrowApplyService {
BeanUtils.copyProperties(record,recordUpdateReqVO); BeanUtils.copyProperties(record,recordUpdateReqVO);
if (StringUtils.isNotNull(updateReqVO.getBorrowState())){ if (StringUtils.isNotNull(updateReqVO.getBorrowState())){
if (record.getBorrowStatus().equals("0")){
return CommonResult.error("档案已被借阅");
}
if (updateReqVO.getBorrowState().equals("2")) { if (updateReqVO.getBorrowState().equals("2")) {
recordUpdateReqVO.setBorrowStatus(null); recordUpdateReqVO.setBorrowStatus(null);
} }
recordUpdateReqVO.setBorrowStatus(updateReqVO.getBorrowState()); recordUpdateReqVO.setBorrowStatus(updateReqVO.getBorrowState());
recordService.updateRecord(recordUpdateReqVO); recordService.updateRecord(recordUpdateReqVO);
} }
@ -79,6 +82,7 @@ public class BorrowApplyServiceImpl implements BorrowApplyService {
// 更新 // 更新
BorrowApplyDO updateObj = BorrowApplyConvert.INSTANCE.convert(updateReqVO); BorrowApplyDO updateObj = BorrowApplyConvert.INSTANCE.convert(updateReqVO);
borrowApplyMapper.updateById(updateObj); borrowApplyMapper.updateById(updateObj);
return CommonResult.success("成功");
} }
@Override @Override

Loading…
Cancel
Save