菜单权限过滤逻辑调整,取消仅按权限过滤

This commit is contained in:
zhangchenbiao
2023-08-02 10:28:42 +08:00
parent a64fc9cd89
commit b86eaa7c52

View File

@@ -37,8 +37,9 @@ public class MenuServiceImpl implements MenuService {
public List<MenuTreeVO> getUserMenus(String userId, String roleId) {
List<SysMenuDO> menuList= sysMenuDAO.selectMenuAll(null);
List<SysRoleMenuDO> roleMenuList = sysRoleMenuDAO.getRoleMenuByRoleId(roleId);
List<Long> anthMenuIdList = menuList.stream().filter(o -> MenuTypeEnum.AUTH.getCode().equals(o.getMenuType())).map(SysMenuDO::getId).collect(Collectors.toList());
List<Long> roleMenuIdList = roleMenuList.stream().map(SysRoleMenuDO::getMenuId).filter(anthMenuIdList::contains).collect(Collectors.toList());
/*List<Long> anthMenuIdList = menuList.stream().filter(o -> MenuTypeEnum.AUTH.getCode().equals(o.getMenuType())).map(SysMenuDO::getId).collect(Collectors.toList());
List<Long> roleMenuIdList = roleMenuList.stream().map(SysRoleMenuDO::getMenuId).filter(anthMenuIdList::contains).collect(Collectors.toList());*/
List<Long> roleMenuIdList = roleMenuList.stream().map(SysRoleMenuDO::getMenuId).collect(Collectors.toList());
Set<Long> authMenuSet = new HashSet<>();
//1倒推菜单列表 2.转换成树`
if (CollectionUtils.isEmpty(roleMenuIdList)) {