dzx 2 месяцев назад
Родитель
Сommit
83f8f94962

+ 10 - 1
src/main/java/com/xjrsoft/module/material/service/impl/MaterialTaskAssignServiceImpl.java

@@ -1,12 +1,15 @@
 package com.xjrsoft.module.material.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.yulichang.base.MPJBaseServiceImpl;
 import com.xjrsoft.module.material.dto.AddMaterialTaskAssignDto;
 import com.xjrsoft.module.material.dto.MaterialAssignUserDto;
 import com.xjrsoft.module.material.dto.MaterialTaskAssignApprovedDto;
 import com.xjrsoft.module.material.entity.MaterialTask;
+import com.xjrsoft.module.material.entity.MaterialTaskAppendix;
 import com.xjrsoft.module.material.entity.MaterialTaskAssign;
+import com.xjrsoft.module.material.mapper.MaterialTaskAppendixMapper;
 import com.xjrsoft.module.material.mapper.MaterialTaskAssignMapper;
 import com.xjrsoft.module.material.mapper.MaterialTaskMapper;
 import com.xjrsoft.module.material.service.IMaterialTaskAssignService;
@@ -19,9 +22,10 @@ import java.util.Optional;
 
 @Service
 @AllArgsConstructor
-public class MaterialTaskAssignServiceImpl   extends MPJBaseServiceImpl<MaterialTaskAssignMapper, MaterialTaskAssign> implements IMaterialTaskAssignService {
+public class MaterialTaskAssignServiceImpl extends MPJBaseServiceImpl<MaterialTaskAssignMapper, MaterialTaskAssign> implements IMaterialTaskAssignService {
     private final MaterialTaskAssignMapper materialTaskAssignMapper;
     private final MaterialTaskMapper materialTaskMapper;
+    private final MaterialTaskAppendixMapper appendixMapper;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -101,6 +105,11 @@ public class MaterialTaskAssignServiceImpl   extends MPJBaseServiceImpl<Material
                     }
                     if (dto.getStatus() == 2) {//重做
                         materialTaskAssign.setStatus(4);
+
+                        appendixMapper.delete(
+                                new QueryWrapper<MaterialTaskAppendix>().lambda()
+                                        .eq(MaterialTaskAppendix::getMaterialTaskId, materialTaskAssign.getId())
+                        );
                     }
 
                     materialTaskAssignMapper.updateById(materialTaskAssign);