| | |
| | | @Autowired |
| | | private ISysMenuService menuService; |
| | | |
| | | /** |
| | | /**current |
| | | * 两层循环实现建树 |
| | | * |
| | | * @param sysMenus |
| | |
| | | if (CollectionUtil.isEmpty(roles)) { |
| | | return ResultBody.ok().data(Collections.emptyList()); |
| | | } |
| | | List<SysMenu> menus = menuService.findByRoleCodes(roles.parallelStream().map(SysRole::getCode).collect(Collectors.toSet()), CommonConstant.MENU); |
| | | Set<String> collect = roles.stream().map(e -> e.getCode()).collect(Collectors.toSet()); |
| | | List<SysMenu> menus = menuService.findByRoleCodes(collect, CommonConstant.MENU); |
| | | return ResultBody.ok().data(treeBuilder(menus)); |
| | | } |
| | | } |