mirror of https://gitee.com/stylefeng/roses
【7.6.0】【sys】更新获取角色的菜单和菜单功能的查询
parent
3f758a68e8
commit
e841a4b064
|
@ -88,4 +88,12 @@ public interface SysRoleMenuOptionsService extends IService<SysRoleMenuOptions>
|
||||||
*/
|
*/
|
||||||
void bindRoleMenuOptions(Long roleId, List<SysMenuOptions> sysMenuOptionsList);
|
void bindRoleMenuOptions(Long roleId, List<SysMenuOptions> sysMenuOptionsList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取角色绑定的菜单功能id
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @since 2023/6/19 12:49
|
||||||
|
*/
|
||||||
|
List<Long> getRoleBindMenuOptionsIdList(List<Long> roleIdList);
|
||||||
|
|
||||||
}
|
}
|
|
@ -80,4 +80,12 @@ public interface SysRoleMenuService extends IService<SysRoleMenu> {
|
||||||
*/
|
*/
|
||||||
void bindRoleMenus(Long roleId, List<SysMenu> menuList);
|
void bindRoleMenus(Long roleId, List<SysMenu> menuList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取角色绑定的菜单id集合,返回菜单id的集合
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @since 2023/6/19 12:45
|
||||||
|
*/
|
||||||
|
List<Long> getRoleBindMenuIdList(List<Long> roleIdList);
|
||||||
|
|
||||||
}
|
}
|
|
@ -27,6 +27,7 @@ import org.springframework.stereotype.Service;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 角色和菜单下的功能关联业务实现层
|
* 角色和菜单下的功能关联业务实现层
|
||||||
|
@ -102,6 +103,25 @@ public class SysRoleMenuOptionsServiceImpl extends ServiceImpl<SysRoleMenuOption
|
||||||
this.getBaseMapper().insertBatchSomeColumn(sysRoleMenuOptionList);
|
this.getBaseMapper().insertBatchSomeColumn(sysRoleMenuOptionList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Long> getRoleBindMenuOptionsIdList(List<Long> roleIdList) {
|
||||||
|
|
||||||
|
if (ObjectUtil.isEmpty(roleIdList)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
LambdaQueryWrapper<SysRoleMenuOptions> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.in(SysRoleMenuOptions::getRoleId, roleIdList);
|
||||||
|
queryWrapper.select(SysRoleMenuOptions::getMenuOptionId);
|
||||||
|
List<SysRoleMenuOptions> roleMenuOptions = this.list(queryWrapper);
|
||||||
|
|
||||||
|
if (ObjectUtil.isEmpty(roleMenuOptions)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
return roleMenuOptions.stream().map(SysRoleMenuOptions::getMenuOptionId).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SysRoleMenuOptions> findList(SysRoleMenuOptionsRequest sysRoleMenuOptionsRequest) {
|
public List<SysRoleMenuOptions> findList(SysRoleMenuOptionsRequest sysRoleMenuOptionsRequest) {
|
||||||
LambdaQueryWrapper<SysRoleMenuOptions> wrapper = this.createWrapper(sysRoleMenuOptionsRequest);
|
LambdaQueryWrapper<SysRoleMenuOptions> wrapper = this.createWrapper(sysRoleMenuOptionsRequest);
|
||||||
|
|
|
@ -110,6 +110,24 @@ public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRo
|
||||||
this.getBaseMapper().insertBatchSomeColumn(sysRoleMenus);
|
this.getBaseMapper().insertBatchSomeColumn(sysRoleMenus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Long> getRoleBindMenuIdList(List<Long> roleIdList) {
|
||||||
|
|
||||||
|
if (ObjectUtil.isEmpty(roleIdList)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
LambdaQueryWrapper<SysRoleMenu> sysRoleMenuLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
sysRoleMenuLambdaQueryWrapper.in(SysRoleMenu::getRoleId, roleIdList);
|
||||||
|
sysRoleMenuLambdaQueryWrapper.select(SysRoleMenu::getMenuId);
|
||||||
|
List<SysRoleMenu> sysRoleMenuList = this.list(sysRoleMenuLambdaQueryWrapper);
|
||||||
|
if (ObjectUtil.isEmpty(sysRoleMenuList)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
return sysRoleMenuList.stream().map(SysRoleMenu::getMenuId).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SysRoleMenu> findList(SysRoleMenuRequest sysRoleMenuRequest) {
|
public List<SysRoleMenu> findList(SysRoleMenuRequest sysRoleMenuRequest) {
|
||||||
LambdaQueryWrapper<SysRoleMenu> wrapper = this.createWrapper(sysRoleMenuRequest);
|
LambdaQueryWrapper<SysRoleMenu> wrapper = this.createWrapper(sysRoleMenuRequest);
|
||||||
|
|
Loading…
Reference in New Issue