【8.1.0】【role】更新角色下拉列表的获取方式

pull/60/head
fengshuonan 2024-01-16 19:05:30 +08:00
parent 20f95b868b
commit 99eb5357e7
2 changed files with 5 additions and 24 deletions

View File

@ -41,17 +41,7 @@ public enum SysRoleExceptionEnum implements AbstractExceptionEnum {
/**
*
*/
ROLE_COMPANY_ERROR(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10006", "非管理员,不能添加其他公司角色"),
/**
*
*/
ROLE_TYPE_QUERY_ERROR(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10007", "非管理员,不能查询系统角色"),
/**
*
*/
ROLE_COMPANY_QUERY_ERROR(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10008", "非管理员,不能查询其他公司角色");
ROLE_COMPANY_ERROR(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10006", "非管理员,不能添加其他公司角色");
/**
*

View File

@ -234,7 +234,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
LambdaQueryWrapper<SysRole> wrapper = this.createWrapper(sysRoleRequest);
// 只查询id和名称
wrapper.select(SysRole::getRoleId, SysRole::getRoleName);
wrapper.select(SysRole::getRoleId, SysRole::getRoleName, SysRole::getRoleType);
// 填写角色的权限信息
this.filterRolePermission(wrapper, sysRoleRequest);
@ -404,18 +404,9 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
return;
}
// 非超级管理员,检验角色类型是否为公司类型角色
if (!RoleTypeEnum.COMPANY_ROLE.getCode().equals(sysRoleRequest.getRoleType())) {
throw new ServiceException(SysRoleExceptionEnum.ROLE_TYPE_QUERY_ERROR);
}
// 非超级管理员,只能查询自己公司的角色
if (sysRoleRequest.getRoleCompanyId() == null || !sysRoleRequest.getRoleCompanyId().equals(LoginContext.me().getCurrentUserCompanyId())) {
throw new ServiceException(SysRoleExceptionEnum.ROLE_COMPANY_QUERY_ERROR);
}
wrapper.eq(SysRole::getRoleType, sysRoleRequest.getRoleType());
wrapper.eq(SysRole::getRoleCompanyId, sysRoleRequest.getRoleCompanyId());
// 非超级管理员直接拼好角色类型和角色的公司id只能查本公司的
wrapper.eq(SysRole::getRoleType, RoleTypeEnum.COMPANY_ROLE.getCode());
wrapper.eq(SysRole::getRoleCompanyId, LoginContext.me().getCurrentUserCompanyId());
}
/**