| | |
| | | roleList.add(0); |
| | | } |
| | | List<Relation> relations = relationService.selectList(new EntityWrapper<Relation>().in("roleid", roleList)); |
| | | Set<Long> collect = relations.stream().map(Relation::getMenuid).collect(Collectors.toSet()); |
| | | List<Menu> menuList = menuService.selectBatchIds(collect); |
| | | if(!relations.isEmpty()){ |
| | | Set<Long> collect = relations.stream().map(Relation::getMenuid).collect(Collectors.toSet()); |
| | | List<Menu> menuList = menuService.selectBatchIds(collect); |
| | | shiroUser.setMenuIds(menuList.stream().map(Menu::getUrl).collect(Collectors.toList())); |
| | | }else{ |
| | | shiroUser.setMenuIds(new ArrayList<>()); |
| | | } |
| | | List<MenuNode> menus = menuService.getMenusByRoleIds(roleList); |
| | | // 根据企业经营范围过滤菜单(在构建树之前过滤) |
| | | TCompany tCompany = companyMapper.selectById(shiroUser.getObjectId()); |
| | |
| | | } |
| | | List<MenuNode> titles = MenuNode.buildTitle(menus); |
| | | titles = ApiMenuFilter.build(titles); |
| | | shiroUser.setMenuIds(menuList.stream().map(Menu::getUrl).collect(Collectors.toList())); |
| | | |
| | | |
| | | model.addAttribute("titles", titles); |