Browse Source

Merge remote-tracking branch 'origin/master'

master
PoffyZhang 1 year ago
parent
commit
b08b8797e1
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/util/TreeUtil.java

+ 3
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/util/TreeUtil.java View File

@@ -129,6 +129,7 @@ public final class TreeUtil {
Map<Long, MenuRoleVO> menuMap, Map<Long, MenuRoleVO> menuMap,
Long parentId, Long parentId,
ListIterator<MenuRoleVO> parentIter) { ListIterator<MenuRoleVO> parentIter) {
MenuRoleVO parentMenu = menuMap.get(parentId);
List<MenuRoleVO> currMenus = menuGroup.get(parentId); List<MenuRoleVO> currMenus = menuGroup.get(parentId);
if (currMenus == null) { if (currMenus == null) {
return Collections.emptyList(); return Collections.emptyList();
@@ -137,6 +138,7 @@ public final class TreeUtil {
if (!parentId.equals(StrPool.DEF_PARENT_ID)) { if (!parentId.equals(StrPool.DEF_PARENT_ID)) {
Map<MenuTypeEnum, List<MenuRoleVO>> group = CollUtils.group(currMenus, MenuRoleVO::getMenuType); Map<MenuTypeEnum, List<MenuRoleVO>> group = CollUtils.group(currMenus, MenuRoleVO::getMenuType);
for (MenuRoleVO vo : group.getOrDefault(MenuTypeEnum.BUTTON, Collections.emptyList())) { for (MenuRoleVO vo : group.getOrDefault(MenuTypeEnum.BUTTON, Collections.emptyList())) {
vo.setTopMenu(parentMenu.getTopMenu());
parentIter.add(vo); parentIter.add(vo);
} }
menus = group.getOrDefault(MenuTypeEnum.MENU, Collections.emptyList()); menus = group.getOrDefault(MenuTypeEnum.MENU, Collections.emptyList());
@@ -150,7 +152,7 @@ public final class TreeUtil {
curr.setPid(null); curr.setPid(null);
curr.setTopMenu(curr.getName()); curr.setTopMenu(curr.getName());
} else { } else {
curr.setTopMenu(menuMap.get(curr.getPid()).getTopMenu());
curr.setTopMenu(parentMenu.getTopMenu());
} }
curr.setChildren(buildUserMenuTree(menuGroup, menuMap, curr.getId(), currIter)); curr.setChildren(buildUserMenuTree(menuGroup, menuMap, curr.getId(), currIter));
} }


Loading…
Cancel
Save