diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/TreeUtil.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/TreeUtil.java index 0bd168c..01eb535 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/util/TreeUtil.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/util/TreeUtil.java @@ -129,6 +129,7 @@ public final class TreeUtil { Map menuMap, Long parentId, ListIterator parentIter) { + MenuRoleVO parentMenu = menuMap.get(parentId); List currMenus = menuGroup.get(parentId); if (currMenus == null) { return Collections.emptyList(); @@ -137,6 +138,7 @@ public final class TreeUtil { if (!parentId.equals(StrPool.DEF_PARENT_ID)) { Map> group = CollUtils.group(currMenus, MenuRoleVO::getMenuType); for (MenuRoleVO vo : group.getOrDefault(MenuTypeEnum.BUTTON, Collections.emptyList())) { + vo.setTopMenu(parentMenu.getTopMenu()); parentIter.add(vo); } menus = group.getOrDefault(MenuTypeEnum.MENU, Collections.emptyList()); @@ -150,7 +152,7 @@ public final class TreeUtil { curr.setPid(null); curr.setTopMenu(curr.getName()); } else { - curr.setTopMenu(menuMap.get(curr.getPid()).getTopMenu()); + curr.setTopMenu(parentMenu.getTopMenu()); } curr.setChildren(buildUserMenuTree(menuGroup, menuMap, curr.getId(), currIter)); }