| 
					
				 | 
			
			
				@@ -19,11 +19,24 @@ public class DimEntityServiceImpl implements DimEntityService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private DimEntityMapper dimEntityMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public List<EntityCodeTreeVo> queryEntityCodeTableTree() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public List<EntityCodeTreeVo> queryEntityCodeTableTree(String id) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        int level = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (StringUtils.isNotEmpty(id)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            int len = id.length(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (len == 1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                level = 2; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else if (len == 2) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                level = 3; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else if (len == 4) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                level = 4; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else if (len == 6) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                level = 5; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //创建视图 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String viewTableName = StringUtils.getTemporaryTableName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         createView(viewTableName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return queryEntityCodeTableTreeData(null, 1, viewTableName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return queryEntityCodeTableTreeData(id, level, viewTableName); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -51,9 +64,8 @@ public class DimEntityServiceImpl implements DimEntityService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (viewsList != null && viewsList.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //获取所有的实体关系表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<String> tablesList = dimEntityMapper.querySchemaTableByName("vector", "实体关系表"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<String> tablesList = dimEntityMapper.querySchemaTableByName("vector", "实体图元关联表"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //通过实体关系表,获取实体关系表中,所有映射的实体代理点。此处创建视图,视图将一个小时后删除 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         StringBuilder viewSql = new StringBuilder(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -69,24 +81,46 @@ public class DimEntityServiceImpl implements DimEntityService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private List<EntityCodeTreeVo> queryEntityCodeTableTreeData(String code, Integer level, String viewTableName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<EntityCodeTreeVo> entityCodeTreeVos = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (level <= 4) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            entityCodeTreeVos = dimEntityMapper.queryEntityCodeTable(code, level); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (EntityCodeTreeVo entityCodeTreeVo : entityCodeTreeVos) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                entityCodeTreeVo.setCount(0L); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<String> d0_tables = dimEntityMapper.queryTablesNameByViewCode(viewTableName, entityCodeTreeVo.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (d0_tables.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    entityCodeTreeVo.setCount(dimEntityMapper.queryEntityCodeTableCountByCode(entityCodeTreeVo.getId(), d0_tables)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<String> d0_tables = dimEntityMapper.queryTablesNameByViewCode(viewTableName, code); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (d0_tables.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                entityCodeTreeVos = dimEntityMapper.queryEntityCodeTableTreeDataByCode(code, d0_tables); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return entityCodeTreeVos; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private List<EntityCodeTreeVo> queryEntityCodeTableTreeDatabak(String code, Integer level, String viewTableName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Long count = 0L; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         List<EntityCodeTreeVo> entityCodeTreeVos = dimEntityMapper.queryEntityCodeTable(code, level); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (level < 4) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for (EntityCodeTreeVo entityCodeTreeVo : entityCodeTreeVos) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 entityCodeTreeVo.setCount(0L); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                List<String> d0_tables = dimEntityMapper.queryTablesNameByViewCode(viewTableName, entityCodeTreeVo.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                if (d0_tables.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    entityCodeTreeVo.setCount(dimEntityMapper.queryEntityCodeTableCountByCode(entityCodeTreeVo.getId(), d0_tables)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                entityCodeTreeVo.setChildren(queryEntityCodeTableTreeData(entityCodeTreeVo.getId(), level + 1, viewTableName)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                List<String> d0_tables = dimEntityMapper.queryTablesNameByViewCode(viewTableName, entityCodeTreeVo.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (d0_tables.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    entityCodeTreeVo.setCount(dimEntityMapper.queryEntityCodeTableCountByCode(entityCodeTreeVo.getId(), d0_tables)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                entityCodeTreeVo.setChildren(queryEntityCodeTableTreeData(entityCodeTreeVo.getId(), level + 1, viewTableName)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             for (EntityCodeTreeVo entityCodeTreeVo : entityCodeTreeVos) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 entityCodeTreeVo.setCount(0L); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 List<String> d0_tables = dimEntityMapper.queryTablesNameByViewCode(viewTableName, entityCodeTreeVo.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (d0_tables.size() > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    entityCodeTreeVo.setCount(dimEntityMapper.queryEntityCodeTableCountByCode(entityCodeTreeVo.getId(), d0_tables)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    entityCodeTreeVo.setChildren(dimEntityMapper.queryEntityCodeTableTreeDataByCode(entityCodeTreeVo.getId(), d0_tables)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    entityCodeTreeVo.setCount(dimEntityMapper.queryEntityCodeTableCountByCode(entityCodeTreeVo.getId(), d0_tables)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    entityCodeTreeVo.setChildren(dimEntityMapper.queryEntityCodeTableTreeDataByCode(entityCodeTreeVo.getId(), d0_tables)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                    entityCodeTreeVo.setCount((long) entityCodeTreeVo.getChildren().size()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 |