Browse Source

feat: 补充删除逻辑

master_tdsql
hxh 9 months ago
parent
commit
cc7b4e431e
  1. 6
      shuili-system/src/main/java/com/kms/yxgh/df/service/DfYhPlanService.java
  2. 11
      shuili-system/src/main/java/com/kms/yxgh/df/service/DfYhRecordService.java
  3. 6
      shuili-system/src/main/java/com/kms/yxgh/sz/service/SzYhPlanService.java
  4. 12
      shuili-system/src/main/java/com/kms/yxgh/sz/service/SzYhRecordService.java

6
shuili-system/src/main/java/com/kms/yxgh/df/service/DfYhPlanService.java

@ -105,6 +105,12 @@ public class DfYhPlanService extends BaseService<DfYhPlanMapper, DfYhPlan> imple
if (CollectionUtil.isEmpty(id)) {
return false;
}
Wrapper<DfYhPlan> wp = Wrappers.<DfYhPlan>lambdaQuery()
.in(DfYhPlan::getId, id)
.notIn(DfYhPlan::getStatus, ApprovalStatusEnum.SUBMITTING.getValue(), ApprovalStatusEnum.REJECT.getValue());
if (this.getBaseMapper().selectCount(wp) > 0) {
throw new DfException("存在不能删除的数据");
}
return removeByIds(id);
}

11
shuili-system/src/main/java/com/kms/yxgh/df/service/DfYhRecordService.java

@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kms.system.service.SysUserService;
import com.kms.yxgh.base.DfException;
import com.kms.yxgh.base.enums.YhRecordStatus;
import com.kms.yxgh.common.ApprovalStatusEnum;
import com.kms.yxgh.common.dto.*;
import com.kms.yxgh.common.service.ApprovalBusinessService;
@ -98,14 +97,20 @@ public class DfYhRecordService extends BaseService<DfYhRecordMapper, DfYhRecord>
if (CollectionUtil.isEmpty(ids)) {
return false;
}
Wrapper<DfYhRecord> wp = Wrappers.<DfYhRecord>lambdaQuery()
.in(DfYhRecord::getId, ids)
.notIn(DfYhRecord::getStatus, ApprovalStatusEnum.SUBMITTING.getValue(), ApprovalStatusEnum.REJECT.getValue());
if (this.getBaseMapper().selectCount(wp) > 0) {
throw new DfException("已确认的记录不能删除");
}
return removeByIds(ids);
}
private boolean checkStatus(String id) {
Wrapper<DfYhRecord> wp = Wrappers.<DfYhRecord>lambdaQuery()
.eq(DfYhRecord::getId, id)
.eq(DfYhRecord::getStatus, YhRecordStatus.CONFIRMED.getValue());
return !(this.getBaseMapper().selectCount(wp) > 0);
.in(DfYhRecord::getStatus, ApprovalStatusEnum.SUBMITTING.getValue(), ApprovalStatusEnum.REJECT.getValue());
return this.getBaseMapper().selectCount(wp) > 0;
}
private boolean exist(String id) {

6
shuili-system/src/main/java/com/kms/yxgh/sz/service/SzYhPlanService.java

@ -106,6 +106,12 @@ public class SzYhPlanService extends BaseService<SzYhPlanMapper, SzYhPlan> imple
if (CollectionUtil.isEmpty(ids)) {
return false;
}
Wrapper<SzYhPlan> wp = Wrappers.<SzYhPlan>lambdaQuery()
.in(SzYhPlan::getId, ids)
.notIn(SzYhPlan::getStatus, ApprovalStatusEnum.SUBMITTING.getValue(), ApprovalStatusEnum.REJECT.getValue());
if (this.getBaseMapper().selectCount(wp) > 0) {
throw new DfException("存在不能删除的数据");
}
return removeByIds(ids);
}

12
shuili-system/src/main/java/com/kms/yxgh/sz/service/SzYhRecordService.java

@ -7,8 +7,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kms.system.service.SysUserService;
import com.kms.yxgh.base.DfException;
import com.kms.yxgh.base.SzException;
import com.kms.yxgh.base.enums.YhRecordStatus;
import com.kms.yxgh.common.ApprovalStatusEnum;
import com.kms.yxgh.common.dto.*;
import com.kms.yxgh.common.service.ApprovalBusinessService;
@ -98,14 +98,20 @@ public class SzYhRecordService extends BaseService<SzYhRecordMapper, SzYhRecord>
if (CollectionUtil.isEmpty(ids)) {
return false;
}
Wrapper<SzYhRecord> wp = Wrappers.<SzYhRecord>lambdaQuery()
.in(SzYhRecord::getId, ids)
.notIn(SzYhRecord::getStatus, ApprovalStatusEnum.SUBMITTING.getValue(), ApprovalStatusEnum.REJECT.getValue());
if (this.getBaseMapper().selectCount(wp) > 0) {
throw new DfException("已确认的记录不能删除");
}
return removeByIds(ids);
}
private boolean checkStatus(String id) {
Wrapper<SzYhRecord> wp = Wrappers.<SzYhRecord>lambdaQuery()
.eq(SzYhRecord::getId, id)
.eq(SzYhRecord::getStatus, YhRecordStatus.CONFIRMED.getValue());
return !(this.getBaseMapper().selectCount(wp) > 0);
.in(SzYhRecord::getStatus, ApprovalStatusEnum.SUBMITTING.getValue(), ApprovalStatusEnum.REJECT.getValue());
return this.getBaseMapper().selectCount(wp) > 0;
}
private boolean exist(String id) {

Loading…
Cancel
Save