mirror of https://gitee.com/stylefeng/roses
【8.0.5】【system】获取当前用户综合性的身份列表
parent
72d26e5061
commit
20f33b6012
|
@ -159,4 +159,16 @@ public interface SysUserServiceApi {
|
|||
*/
|
||||
List<SimpleDict> batchGetNameByUserIdList(Set<Long> userIdList);
|
||||
|
||||
/**
|
||||
* 获取当前用户综合性的身份列表
|
||||
* <p>
|
||||
* 1. 获取当前用户id,加入到结果
|
||||
* 2. 获取用户当前登录的机构id,加入到结果
|
||||
* 3. 获取用户拥有的角色id,加入到结果
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2024-01-09 18:54
|
||||
*/
|
||||
Set<Long> getUserComprehensiveIdentitySummary();
|
||||
|
||||
}
|
||||
|
|
|
@ -715,6 +715,37 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
return this.batchGetName(sysUserRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Long> getUserComprehensiveIdentitySummary() {
|
||||
|
||||
LoginUser loginUser = LoginContext.me().getLoginUserNullable();
|
||||
if (loginUser == null) {
|
||||
return new HashSet<>();
|
||||
}
|
||||
|
||||
// 获取当前登录用户id
|
||||
Long userId = loginUser.getUserId();
|
||||
|
||||
// 获取当前用户登录的机构id
|
||||
Long currentOrgId = loginUser.getCurrentOrgId();
|
||||
|
||||
// 获取当前用户的角色信息列表
|
||||
List<Long> userRoleIdList = sysUserRoleService.getUserRoleIdList(userId);
|
||||
|
||||
HashSet<Long> comprehensiveIdentity = new HashSet<>();
|
||||
if (ObjectUtil.isNotEmpty(userId)) {
|
||||
comprehensiveIdentity.add(userId);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(currentOrgId)) {
|
||||
comprehensiveIdentity.add(currentOrgId);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(userRoleIdList)) {
|
||||
comprehensiveIdentity.addAll(userRoleIdList);
|
||||
}
|
||||
|
||||
return comprehensiveIdentity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取信息
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue