Explorar el Código

优化:工程划分>>增加批量删除功能

lvy hace 3 meses
padre
commit
eb3d716960

+ 4 - 1
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -3161,7 +3161,7 @@ public R removeContractTreeNodeJudge(@RequestParam String ids) {
             if (!removeList.isEmpty()) {
                 String wbsIds = removeList.stream().map(Object::toString).collect(Collectors.joining(","));
                 /** 判断是否子节点有上报或审批过的资料,因为父id和祖级节点错误,直接使用上面的值去查询上报情况*/
-                List<String> unRemoveIds = jdbcTemplate.queryForList("SELECT wbs_id from u_information_query WHERE wbs_id in (" + wbsIds + ") GROUP BY wbs_id HAVING count(1) > 0", String.class);
+                List<String> unRemoveIds = jdbcTemplate.queryForList("SELECT wbs_id from u_information_query WHERE wbs_id in (" + wbsIds + ") and is_deleted = 0 and status in (1,2) GROUP BY wbs_id HAVING count(1) > 0", String.class);
                 if (!unRemoveIds.isEmpty()) {
                     // 剔除此节点
                     Map<String, String> map = unRemoveIds.stream().collect(Collectors.toMap(id -> id, Function.identity()));
@@ -3180,6 +3180,9 @@ public R removeContractTreeNodeJudge(@RequestParam String ids) {
                     unremoveNodeMap.putAll(tempMap);
                 }
             }
+            if(removeNodeList.isEmpty()) {
+                return R.fail("删除失败,该节点下有已填报的资料");
+            }
 
             StringBuilder position = new StringBuilder();
             List<String> idArray = removeNodeList.stream().filter(wbsTreeContract -> !unremoveNodeMap.containsKey(wbsTreeContract.getPKeyId())).map(wbsTreeContract -> {