فهرست منبع

履职内容库删除项、内容逻辑完善

jiawuxian 2 سال پیش
والد
کامیت
c130e952f0

+ 9 - 9
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/AppRuleItemServiceImpl.java

@@ -96,17 +96,17 @@ public class AppRuleItemServiceImpl extends ServiceImpl<AppRuleItemMapper, AppRu
         }
 
 
-        final List<Long> pointIds = appRulePointMapper.selectPointIds(item.getId());
+        List<Long> pointIds = appRulePointMapper.selectPointIds(item.getId());
         if (pointIds.size() > 0) {
             List<Long> idList2 = pointDtoList.stream().map(AppRulePointDto::getId).collect(Collectors.toList());
-            for (Long pointId : pointIds) {
-                if (!idList2.contains(pointId)) {
-                    Integer isUsed = appRulePointMapper.checkIsUsed(pointId);
-                    if (isUsed == null) {
-                        appRulePointMapper.deleteById(pointId);
-                    } else {
-                        throw new RuntimeException("履职内容已被使用,不能删除!");
-                    }
+            pointIds= pointIds.stream().filter(p->!idList2.contains(p))
+                    .collect(Collectors.toList());
+            if(CollectionUtil.isNotEmpty(pointIds)){
+                Integer isUsed= appRulePointMapper.checkIsJoinResumptionPlan(pointIds);
+                if(ObjectUtil.isNotNull(isUsed)){
+                    throw new RuntimeException("履职内容已被履职计划使用,不能删除!");
+                }else{
+                    appRulePointMapper.deleteBatchIds(pointIds);
                 }
             }
         }

+ 3 - 2
soc-modules/soc-modules-core/src/main/resources/mapper/resumption/AppRulePointMapper.xml

@@ -230,8 +230,9 @@
     </select>
     <select id="checkIsJoinResumptionPlan" resultType="java.lang.Integer">
         SELECT DISTINCT 1
-        FROM core_resumption_plan_to_point
-        WHERE point_id in
+        FROM core_resumption_plan_to_point pp
+        INNER join core_resumption_plan p on p.id=pp.plan_id and p.deleted=0
+        WHERE pp.point_id in
         <foreach collection="pointIds" item="pointId" index="index" open="(" separator="," close=")">
             #{pointId}
         </foreach>