2021与蓝度共同重构项目,服务端
MercuryZ
2022-06-23 d0817418a1c0fc3d637cb3cb2a2fb7f8c1a42d0b
ximon-admin/src/main/java/com/sandu/ximon/admin/service/MenuService.java
@@ -42,7 +42,8 @@
     * 获取角色下的菜单
     */
    public List<Menu> listByRoleIds(List<Long> roleIdList) {
        List<Long> menuIdList = roleMenuRelationService.list(Wrappers.lambdaQuery(RoleMenuRelation.class).in(RoleMenuRelation::getRoleId, roleIdList).select(RoleMenuRelation::getMenuId))
        List<Long> menuIdList = roleMenuRelationService.list(Wrappers.lambdaQuery(RoleMenuRelation.class)
                        .in(RoleMenuRelation::getRoleId, roleIdList).select(RoleMenuRelation::getMenuId))
                .stream().map(RoleMenuRelation::getMenuId).distinct().collect(Collectors.toList());
        if (CollectionUtil.isEmpty(menuIdList)) {
            return null;
@@ -56,21 +57,6 @@
        BeanUtils.copyProperties(param, menu);
        return save(menu);
    }
//    public Set<Menu> listMenuByRoles(Set<Role> roles) {
//        List<Long> roleIds = roles.stream().map(Role::getId).collect(Collectors.toList());
//        Set<Menu> menus = menuDao.listMenuByRoleIds(roleIds);
//        return menus;
//    }
//
//    /**
//     * 把菜单转成树形结构
//     */
//    public List<MenuNode> buildTree(List<Menu> menuList) {
//        return menuList.stream()
//                .filter(menu -> menu.getPid().equals(0L))
//                .map(menu -> covertMenuNode(menu, menuList)).collect(Collectors.toList());
//    }
    private MenuNode covertMenuNode(Menu menu, List<Menu> menuList) {
        MenuNode node = new MenuNode();