Przeglądaj źródła

质检-资料填报-同步标识
1、第一次加载wbs树添加忽略处理

LHB 1 miesiąc temu
rodzic
commit
cb03a21066

+ 16 - 14
blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java

@@ -762,22 +762,24 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
             ContractInfo contractInfo = jdbcTemplate.query("SELECT contract_name,contract_type FROM m_contract_info WHERE id = " + contractId,
                     new BeanPropertyRowMapper<>(ContractInfo.class)).stream().findAny().orElse(null);
 
-            //查询当前节点的祖级路径和pkid
-            String ancestors = jdbcTemplate.query("SELECT concat(ancestors_p_id,',',p_key_id) FROM m_wbs_tree_contract WHERE contract_id = " + contractId
-                            + "and id = " + id,
-                    new BeanPropertyRowMapper<>(String.class)).stream().findAny().orElse(null);
-
-            String contractExtendSql = "select ancestors from m_wbs_tree_contract_extend where type = " + tableOwner + " and is_sync = 1 and is_deleted = 0 and ancestors like concat( " + ancestors + ",'%')";
             Set<String> ids = new HashSet<>();
             List<String> strings = null;
-            try {
-                strings = jdbcTemplate.queryForList(contractExtendSql, String.class);
-            } catch (DataAccessException e) {
-                e.printStackTrace();
-                //TODO 暂时忽略错误
-            }
-            if(CollectionUtil.isNotEmpty(strings)){
-                strings.stream().filter(StringUtils::isNotEmpty).forEach(f -> ids.addAll(Arrays.asList(f.split(","))));
+            if (StringUtil.isNotBlank(id)) {
+                //查询当前节点的祖级路径和pkid
+                String ancestors = jdbcTemplate.query("SELECT concat(ancestors_p_id,',',p_key_id) FROM m_wbs_tree_contract WHERE contract_id = " + contractId
+                                + "and id = " + id,
+                        new BeanPropertyRowMapper<>(String.class)).stream().findAny().orElse(null);
+
+                String contractExtendSql = "select ancestors from m_wbs_tree_contract_extend where type = " + tableOwner + " and is_sync = 1 and is_deleted = 0 and ancestors like concat( " + ancestors + ",'%')";
+                try {
+                    strings = jdbcTemplate.queryForList(contractExtendSql, String.class);
+                } catch (DataAccessException e) {
+                    e.printStackTrace();
+                    //TODO 暂时忽略错误
+                }
+                if (CollectionUtil.isNotEmpty(strings)) {
+                    strings.stream().filter(StringUtils::isNotEmpty).forEach(f -> ids.addAll(Arrays.asList(f.split(","))));
+                }
             }
 
             if (contractInfo != null) {