瀏覽代碼

登录用户权限pid置空

master
WendyYang 1 年之前
父節點
當前提交
4292c2c20a
共有 1 個檔案被更改,包括 3 行新增37 行删除
  1. +3
    -37
      pmapi/src/main/java/com/ningdatech/pmapi/common/util/TreeUtil.java

+ 3
- 37
pmapi/src/main/java/com/ningdatech/pmapi/common/util/TreeUtil.java 查看文件

@@ -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;
}
}

Loading…
取消
儲存