|
|
@@ -65,6 +65,7 @@ public final class TreeUtil { |
|
|
|
List<? extends Serializable> allIds = treeList.stream().map(node -> node.getId()).collect(Collectors.toList()); |
|
|
|
for (E baseNode : treeList) { |
|
|
|
if (!allIds.contains(baseNode.getPid()) || selfIdEqSelfParent.contains(baseNode.getPid())) { |
|
|
|
baseNode.setPid(null); |
|
|
|
baseNode.setTopMenu(baseNode.getName()); |
|
|
|
trees.add(baseNode); |
|
|
|
} |
|
|
@@ -132,9 +133,10 @@ public final class TreeUtil { |
|
|
|
if (currMenus == null) { |
|
|
|
return Collections.emptyList(); |
|
|
|
} |
|
|
|
ArrayList<MenuRoleVO> menus = new ArrayList<>(currMenus); |
|
|
|
List<MenuRoleVO> menus = new ArrayList<>(currMenus); |
|
|
|
for (MenuRoleVO curr : currMenus) { |
|
|
|
if (curr.getPid().equals(StrPool.DEF_PARENT_ID)) { |
|
|
|
curr.setPid(null); |
|
|
|
curr.setTopMenu(curr.getName()); |
|
|
|
} else { |
|
|
|
curr.setTopMenu(menuMap.get(curr.getPid()).getTopMenu()); |
|
|
@@ -153,40 +155,4 @@ public final class TreeUtil { |
|
|
|
return menus; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 动态判断redirect |
|
|
|
* |
|
|
|
* @param baseNode |
|
|
|
*/ |
|
|
|
private static void checkRedirect(MenuRoleVO baseNode) { |
|
|
|
checkMenuRedirect(baseNode, baseNode.getChildren()); |
|
|
|
} |
|
|
|
|
|
|
|
private static Boolean checkMenuRedirect(MenuRoleVO baseNode, List<MenuRoleVO> menus) { |
|
|
|
if (baseNode.getSize() > 0) { |
|
|
|
for (MenuRoleVO menu : menus) { |
|
|
|
if (menu.getPath().endsWith("Datav")) { |
|
|
|
baseNode.setRedirect(menu.getComponent()); |
|
|
|
return Boolean.TRUE; |
|
|
|
} |
|
|
|
|
|
|
|
if (menu.getSize() == 0 && 0 == menu.getHidden()) { |
|
|
|
baseNode.setRedirect(menu.getComponent()); |
|
|
|
return Boolean.TRUE; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//一轮没有合适的菜单 去三级菜单找 |
|
|
|
for (MenuRoleVO menu : menus) { |
|
|
|
if (menu.getSize() > 0) { |
|
|
|
if (checkMenuRedirect(baseNode, menu.getChildren())) { |
|
|
|
return Boolean.TRUE; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return Boolean.FALSE; |
|
|
|
} |
|
|
|
} |