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