【7.2.5】【role】更新角色绑定菜单权限接口

pull/37/head
fengshuonan 2022-09-28 17:19:24 +08:00
parent 42643a0618
commit 6a3efaa7b6
2 changed files with 5 additions and 3 deletions

View File

@ -191,12 +191,14 @@ public class AntdMenusFactory {
// 先转化第一层级的菜单
List<MenuAndButtonTreeResponse> menuAndButtonTreeResponses = parseMenuAndButtonTreeResponse(sysMenuList, roleBindMenus);
// 转化菜单的子集
// 遍历所有菜单,查看是否有二级菜单
for (SysMenu sysMenu : sysMenuList) {
// 如果存在二级菜单,则继续进行转化
if (ObjectUtil.isNotEmpty(sysMenu.getChildren())) {
for (MenuAndButtonTreeResponse menuAndButtonTreeRespons : menuAndButtonTreeResponses) {
if (sysMenu.getMenuId().equals(menuAndButtonTreeRespons.getId())) {
List<MenuAndButtonTreeResponse> subLevelItems = parseMenuAndButtonTreeResponse(sysMenuList, roleBindMenus);
List<MenuAndButtonTreeResponse> subLevelItems = parseMenuAndButtonTreeResponse(sysMenu.getChildren(), roleBindMenus);
menuAndButtonTreeRespons.setChildren(subLevelItems);
}
}

View File

@ -517,7 +517,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
}
// 将组装好的一级菜单和里边的children都转化为响应对象并填充checked标识
return AntdMenusFactory.parseMenuAndButtonTreeResponseWithChildren(sysMenuList, roleMenuList);
return AntdMenusFactory.parseMenuAndButtonTreeResponseWithChildren(ListUtil.toList(firstLevelMenus.values()), roleMenuList);
}
@Override