|
@@ -212,8 +212,8 @@ public class DataResourceFacade implements IDataResourceFacade {
|
|
|
resourceVo.setTotal(0);
|
|
|
} else {
|
|
|
// 拼接表、列、pid
|
|
|
- boolean b = combinePidAndTableInfo(topTreeVo, tabLabMap, dataResourceEnum);
|
|
|
- if (b) {
|
|
|
+ int count = combinePidAndTableInfo(topTreeVo, tabLabMap, dataResourceEnum);
|
|
|
+ if (count == 0) {
|
|
|
resourceVo.setNodes(new ArrayList<>());
|
|
|
resourceVo.setTotal(0);
|
|
|
} else {
|
|
@@ -221,7 +221,7 @@ public class DataResourceFacade implements IDataResourceFacade {
|
|
|
add(topTreeVo);
|
|
|
}});
|
|
|
}
|
|
|
-
|
|
|
+ resourceVo.setTotal(count);
|
|
|
}
|
|
|
return resourceVo;
|
|
|
}
|
|
@@ -339,8 +339,8 @@ public class DataResourceFacade implements IDataResourceFacade {
|
|
|
resourceVo.setNodes(new ArrayList<>());
|
|
|
resourceVo.setTotal(0);
|
|
|
} else {
|
|
|
- boolean b = combinePidTabAndCol(topTreeVo, tableMap, colInfosMap, dataResourceEnum);
|
|
|
- if (b) {
|
|
|
+ int count = combinePidTabAndCol(topTreeVo, tableMap, colInfosMap, dataResourceEnum);
|
|
|
+ if (count == 0) {
|
|
|
resourceVo.setNodes(new ArrayList<>());
|
|
|
resourceVo.setTotal(0);
|
|
|
} else {
|
|
@@ -348,6 +348,7 @@ public class DataResourceFacade implements IDataResourceFacade {
|
|
|
add(topTreeVo);
|
|
|
}});
|
|
|
}
|
|
|
+ resourceVo.setTotal(count);
|
|
|
}
|
|
|
return resourceVo;
|
|
|
}
|
|
@@ -356,7 +357,8 @@ public class DataResourceFacade implements IDataResourceFacade {
|
|
|
return colInfos.stream().collect(Collectors.groupingBy(AppDataItemInfo::getColumnClassify));
|
|
|
}
|
|
|
|
|
|
- private boolean combinePidTabAndCol(DataResourceTreeVo treeVo, Map<String, AppDataResourceInfo> tableMap, Map<String, List<AppDataItemInfo>> colInfosMap, DataResourceEnum resourceEnum) {
|
|
|
+ private int combinePidTabAndCol(DataResourceTreeVo treeVo, Map<String, AppDataResourceInfo> tableMap, Map<String, List<AppDataItemInfo>> colInfosMap, DataResourceEnum resourceEnum) {
|
|
|
+ int count = 0;
|
|
|
List<DataResourceTreeVo> child = treeVo.getChild();
|
|
|
Iterator<DataResourceTreeVo> iterator = child.iterator();
|
|
|
while (iterator.hasNext()) {
|
|
@@ -366,9 +368,11 @@ public class DataResourceFacade implements IDataResourceFacade {
|
|
|
List<DataResourceTreeVo> cc = childVo.getChild();
|
|
|
if (CollectionUtils.isNotEmpty(cc)) {
|
|
|
childVo.setTreeNode(true);
|
|
|
- boolean emptyChild = combinePidTabAndCol(childVo, tableMap, colInfosMap, resourceEnum);
|
|
|
- if (emptyChild) {
|
|
|
+ int childCount = combinePidTabAndCol(childVo, tableMap, colInfosMap, resourceEnum);
|
|
|
+ if (childCount == 0) {
|
|
|
iterator.remove();
|
|
|
+ } else {
|
|
|
+ count += childCount;
|
|
|
}
|
|
|
} else {
|
|
|
// 如果为叶子节点,查找对应的表和列
|
|
@@ -386,10 +390,11 @@ public class DataResourceFacade implements IDataResourceFacade {
|
|
|
}).flatMap(List::stream).collect(Collectors.toList());
|
|
|
childVo.setTreeNode(true);
|
|
|
childVo.setChild(tableVos);
|
|
|
+ count += dataColInfo.size();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return CollectionUtils.isEmpty(child);
|
|
|
+ return count;
|
|
|
}
|
|
|
|
|
|
private DataResourceTreeVo convertFieldClaToNode(FieldCla item, String pid) {
|
|
@@ -793,7 +798,8 @@ public class DataResourceFacade implements IDataResourceFacade {
|
|
|
* @param dataResourceEnum
|
|
|
* @return
|
|
|
*/
|
|
|
- private boolean combinePidAndTableInfo(DataResourceTreeVo treeVo, Map<String, List<AppDataResourceInfo>> tabInfosMap, DataResourceEnum dataResourceEnum) {
|
|
|
+ private int combinePidAndTableInfo(DataResourceTreeVo treeVo, Map<String, List<AppDataResourceInfo>> tabInfosMap, DataResourceEnum dataResourceEnum) {
|
|
|
+ int count = 0;
|
|
|
List<DataResourceTreeVo> child = treeVo.getChild();
|
|
|
Iterator<DataResourceTreeVo> iterator = child.iterator();
|
|
|
while (iterator.hasNext()) {
|
|
@@ -803,9 +809,11 @@ public class DataResourceFacade implements IDataResourceFacade {
|
|
|
List<DataResourceTreeVo> cc = childVo.getChild();
|
|
|
if (CollectionUtils.isNotEmpty(cc)) {
|
|
|
childVo.setTreeNode(true);
|
|
|
- boolean emptyChild = combinePidAndTableInfo(childVo, tabInfosMap, dataResourceEnum);
|
|
|
- if (emptyChild) {
|
|
|
+ int childCount = combinePidAndTableInfo(childVo, tabInfosMap, dataResourceEnum);
|
|
|
+ if (childCount == 0) {
|
|
|
iterator.remove();
|
|
|
+ } else {
|
|
|
+ count += childCount;
|
|
|
}
|
|
|
} else {
|
|
|
// 如果为叶子节点,查找对应的表和列
|
|
@@ -821,10 +829,11 @@ public class DataResourceFacade implements IDataResourceFacade {
|
|
|
List<DataResourceTreeVo> tableVos = convertTableToTreeVo(childVo.getId(), dataTabInfo, null, dataResourceEnum);
|
|
|
childVo.setTreeNode(true);
|
|
|
childVo.setChild(tableVos);
|
|
|
+ count += tableVos.size();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return CollectionUtils.isEmpty(child);
|
|
|
+ return count;
|
|
|
}
|
|
|
|
|
|
private List<DataResourceTreeVo> convertTableToTreeVo(String pid, List<AppDataResourceInfo> dataTabInfo, Map<String, List<AppDataItemInfo>> colInfosMap, DataResourceEnum resourceEnum) {
|