opt:需求单删除增加状态校验:只有生成,分配的可以删除

This commit is contained in:
zhangzq
2026-08-04 15:09:39 +08:00
parent a287bb265a
commit defa77dfd6

View File

@@ -161,6 +161,12 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
if (CollectionUtils.isEmpty(ids)) { if (CollectionUtils.isEmpty(ids)) {
return; return;
} }
final List<PmDemand> pmDemands = this.listByIds(ids);
for (PmDemand pmDemand : pmDemands) {
if (!pmDemand.getStatus().equals(DemandStatus.CREATE.getValue()) && !pmDemand.getStatus().equals(DemandStatus.DIS.getValue())){
throw new BadRequestException("删除失败,已经执行的需求单无法删除");
}
}
this.update(new LambdaUpdateWrapper<PmDemand>().in(PmDemand::getId,ids) this.update(new LambdaUpdateWrapper<PmDemand>().in(PmDemand::getId,ids)
.set(PmDemand::getIs_deleted,1)); .set(PmDemand::getIs_deleted,1));
} }