浏览代码

sop删除问题

车车 3 月之前
父节点
当前提交
de5c077678

+ 12 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/dal/mysql/sop/SopExecutionPlanMapper.java

@@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
 import cn.iocoder.yudao.module.iscs.controller.admin.sop.vo.SopExecutionPlanPageReqVO;
 import cn.iocoder.yudao.module.iscs.controller.admin.sop.vo.SopExecutionPlanRespVO;
 import cn.iocoder.yudao.module.iscs.dal.dataobject.sop.SopExecutionPlanDO;
+import org.apache.ibatis.annotations.Delete;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -36,4 +37,15 @@ public interface SopExecutionPlanMapper extends BaseMapperX<SopExecutionPlanDO>
 
     List<SopExecutionPlanRespVO> getList(@Param(value = "vo") SopExecutionPlanRespVO vo);
 
+    @Delete({
+            "<script>",
+            "DELETE FROM isc_sop_execution_plan",
+            "WHERE id IN",
+            "<foreach item='id' collection='ids' open='(' separator=',' close=')'>",
+            "#{id}",
+            "</foreach>",
+            "</script>"
+    })
+    Boolean physicalDeleteByIds(@Param(value = "ids") List<Long> ids);
+
 }

+ 0 - 7
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/service/sop/SopExecutionPlanService.java

@@ -33,13 +33,6 @@ public interface SopExecutionPlanService extends IService<SopExecutionPlanDO> {
      */
     void updateSopExecutionPlan(@Valid SopExecutionPlanSaveReqVO updateReqVO);
 
-    /**
-     * 删除SOP计划执行
-     *
-     * @param id 编号
-     */
-    void deleteSopExecutionPlan(Long id);
-
     /**
     * 批量删除SOP计划执行
     *

+ 1 - 8
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/service/sop/SopExecutionPlanServiceImpl.java

@@ -1,7 +1,6 @@
 package cn.iocoder.yudao.module.iscs.service.sop;
 
 
-import cn.hutool.core.date.LocalDateTimeUtil;
 import cn.hutool.core.lang.Assert;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
@@ -133,16 +132,10 @@ public class SopExecutionPlanServiceImpl extends ServiceImpl<SopExecutionPlanMap
         return strings;
     }
 
-    @Override
-    public void deleteSopExecutionPlan(Long id) {
-        // 删除
-        sopExecutionPlanMapper.deleteById(id);
-    }
-
     @Override
     public void deleteSopExecutionPlanListByIds(List<Long> ids) {
         // 删除
-        sopExecutionPlanMapper.deleteByIds(ids);
+        sopExecutionPlanMapper.physicalDeleteByIds(ids);
     }
 
 

+ 7 - 0
yudao-module-iscs/src/main/java/cn/iocoder/yudao/module/iscs/service/sop/SopServiceImpl.java

@@ -174,6 +174,13 @@ public class SopServiceImpl extends ServiceImpl<SopMapper, SopDO> implements Sop
                 List<Long> idList = sopWorkflowStepList.stream().map(SopWorkflowStepDO::getId).toList();
                 sopWorkflowStepService.deleteSopWorkflowStepListByIds(idList);
             }
+            // 删除isc_sop_execution_plan
+            List<SopExecutionPlanDO> sopExecutionPlanDOList = sopExecutionPlanService.list(Wrappers.<SopExecutionPlanDO>lambdaQuery()
+                    .in(SopExecutionPlanDO::getSopId, ids));
+            if (!sopExecutionPlanDOList.isEmpty()) {
+                List<Long> idList = sopExecutionPlanDOList.stream().map(SopExecutionPlanDO::getId).toList();
+                sopExecutionPlanService.deleteSopExecutionPlanListByIds(idList);
+            }
         }
     }