|
@@ -63,8 +63,21 @@ public class SbUnusedServiceImpl extends BaseServiceImpl<SbUnusedMapper, SbUnuse
|
|
|
private final SysFileService sysFileService;
|
|
|
private SysFileMapper sysFileMapper;
|
|
|
|
|
|
+ @Override
|
|
|
+ public void deleteByPrimaryKey(String id) {
|
|
|
+ super.deleteByPrimaryKey(id);
|
|
|
+ Weekend<SbUnusedDetail> weekend = new Weekend<>(SbUnusedDetail.class);
|
|
|
+ WeekendCriteria<SbUnusedDetail,Object> weekendCriteria = weekend.weekendCriteria();
|
|
|
+ weekendCriteria.andEqualTo(SbUnusedDetail::getSbUnusedId,id);
|
|
|
+ sbUnusedDetailMapper.deleteByExample(weekend);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void modModelByDTO(SbUnusedDTO model) {
|
|
|
+ SbUnused unused = mapper.selectByPrimaryKey(model.getId());
|
|
|
+ if (unused==null){
|
|
|
+ throw new BusinessException("该闲置单已不存在!");
|
|
|
+ }
|
|
|
String id = model.getId();
|
|
|
SbUnusedDetail deleteDetail = new SbUnusedDetail();
|
|
|
deleteDetail.setSbUnusedId(id);
|
|
@@ -109,6 +122,9 @@ public class SbUnusedServiceImpl extends BaseServiceImpl<SbUnusedMapper, SbUnuse
|
|
|
public void saveAgain(SbUnusedDTO dto) {
|
|
|
UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
SbUnused unused = mapper.selectByPrimaryKey(dto.getId());
|
|
|
+ if (unused==null){
|
|
|
+ throw new BusinessException("该闲置单已不存在!");
|
|
|
+ }
|
|
|
if (!userInfo.getUserId().equals(unused.getApplyUserId())){
|
|
|
throw new BusinessException("对不起,只有申请人可以修改闲置单!");
|
|
|
}
|
|
@@ -220,6 +236,9 @@ public class SbUnusedServiceImpl extends BaseServiceImpl<SbUnusedMapper, SbUnuse
|
|
|
public SbUnusedVO getModelById2(String id) {
|
|
|
|
|
|
SbUnusedVO vo = mapper.getUnusedVO(id);
|
|
|
+ if (vo==null){
|
|
|
+ throw new BusinessException("该闲置单已不存在!");
|
|
|
+ }
|
|
|
SbUnusedDetailDTO queryDetail = new SbUnusedDetailDTO();
|
|
|
queryDetail.setSbUnusedId(id);
|
|
|
List<SbUnusedDetailVO> sbUnusedDetailVOS = sbUnusedDetailMapper.selectList(queryDetail);
|
|
@@ -251,6 +270,9 @@ public class SbUnusedServiceImpl extends BaseServiceImpl<SbUnusedMapper, SbUnuse
|
|
|
public void unusedVerify(String id, SbUnusedDTO dto) {
|
|
|
UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
SbUnused unused = mapper.selectByPrimaryKey(id);
|
|
|
+ if (unused==null){
|
|
|
+ throw new BusinessException("该闲置单已不存在!");
|
|
|
+ }
|
|
|
if (unused.getStatus().equals(SbUnusedStatusEnum.verifying_one.getValue()) && !unused.getVerityUserId().equals(userInfo.getUserId()) ){
|
|
|
throw new BusinessException("对不起,您没有权限进行本次审核!");
|
|
|
}
|