authList优化
This commit is contained in:
@@ -41,9 +41,6 @@ public class MenuAuthTreeVO {
|
||||
@ApiModelProperty("菜单类型 1菜单 2权限")
|
||||
private Integer menuType;
|
||||
|
||||
@ApiModelProperty("权限列表")
|
||||
private List<MenuAuthTreeVO> authorityList;
|
||||
|
||||
@ApiModelProperty("子菜单")
|
||||
private List<MenuAuthTreeVO> children;
|
||||
|
||||
@@ -82,23 +79,15 @@ public class MenuAuthTreeVO {
|
||||
}
|
||||
|
||||
public static void getChild(MenuAuthTreeVO data, Map<Long, List<SysMenuDO>> parentGroup) {
|
||||
List<SysMenuDO> sysMenuDOList = parentGroup.get(data.getId());
|
||||
List<SysMenuDO> parentMenuList = ListUtils.emptyIfNull(sysMenuDOList).stream().filter(menu -> MenuTypeEnum.MENU.getCode().equals(menu.getMenuType())).collect(Collectors.toList());
|
||||
List<SysMenuDO> parentAuthList = ListUtils.emptyIfNull(sysMenuDOList).stream().filter(menu -> MenuTypeEnum.AUTH.getCode().equals(menu.getMenuType())).collect(Collectors.toList());
|
||||
List<SysMenuDO> menuList = parentGroup.get(data.getId());
|
||||
//属于菜单下时候
|
||||
if (CollectionUtils.isNotEmpty(parentMenuList)) {
|
||||
List<MenuAuthTreeVO> voList = convertVO(parentMenuList);
|
||||
List<MenuAuthTreeVO> menuList = voList.stream().filter(vo -> MenuTypeEnum.MENU.getCode().equals(vo.getMenuType())).collect(Collectors.toList());
|
||||
data.setChildren(menuList);
|
||||
if (CollectionUtils.isNotEmpty(menuList)) {
|
||||
List<MenuAuthTreeVO> voList = convertVO(menuList);
|
||||
data.setChildren(voList);
|
||||
voList.forEach(child -> {
|
||||
getChild(child, parentGroup);
|
||||
});
|
||||
}
|
||||
//数据是权限的的时候
|
||||
if (CollectionUtils.isNotEmpty(parentAuthList)) {
|
||||
List<MenuAuthTreeVO> authorityList = convertVO(parentAuthList);
|
||||
data.setAuthorityList(authorityList);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user