瀏覽代碼

质检-资料填报-同步标识
1、修改查询标识逻辑

LHB 1 月之前
父節點
當前提交
a920e391cc

+ 8 - 7
blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java

@@ -766,12 +766,13 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
             List<String> strings = null;
             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 + ",'%')";
+                String s = "SELECT concat(ancestors_p_id,',',p_key_id) FROM m_wbs_tree_contract WHERE contract_id = " + contractId + " and id = " + id + " limit 1";
+                if(StringUtil.isNotBlank(contractIdRelation)){
+                    s = "SELECT concat(ancestors_p_id,',',p_key_id) FROM m_wbs_tree_contract WHERE contract_id = " + contractIdRelation + " and id = " + id + " limit 1";
+                }
                 try {
+                    String ancestors = jdbcTemplate.queryForObject(s,String.class);
+                    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 + "','%')";
                     strings = jdbcTemplate.queryForList(contractExtendSql, String.class);
                 } catch (DataAccessException e) {
                     e.printStackTrace();
@@ -919,7 +920,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
 //                            }
                         }
                         if(CollectionUtil.isNotEmpty(ids)){
-                            lazyNodes.forEach(f -> f.setIsSync(ids.contains(f.getPKeyId()) ? 1 : 0));
+                            lazyNodes.forEach(f -> f.setIsSync(ids.contains(f.getPKeyId().toString()) ? 1 : 0));
                         }
                         return lazyNodes;
                     }
@@ -1061,7 +1062,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
                         }
                     }
                     if(CollectionUtil.isNotEmpty(ids)){
-                        lazyNodesAll.forEach(f -> f.setIsSync(ids.contains(f.getPKeyId()) ? 1 : 0));
+                        lazyNodesAll.forEach(f -> f.setIsSync(ids.contains(f.getPKeyId().toString()) ? 1 : 0));
                     }
                     return lazyNodesAll;
                 }