|
@@ -327,8 +327,12 @@ public class WebGatewayImpl implements WebGateway {
|
|
|
StpUtil.login(RedisCacheConstant.WEB_USER_PRE + adminUser.getUserId(), DeviceType.WEB.getCode());
|
|
|
|
|
|
// 查询登录用户的roleId
|
|
|
- TblUserRole userRole = tblUserRoleService.getByUserId(adminUser.getUserId());
|
|
|
- Long roleId = userRole.getRoleId();
|
|
|
+ List <TblUserRole> userRoles = tblUserRoleService.listByUserId(adminUser.getUserId());
|
|
|
+ List<Long> roleIds = new ArrayList<>();
|
|
|
+ if (userRoles != null && !userRoles.isEmpty()) {
|
|
|
+ // 收集所有角色ID
|
|
|
+ roleIds = userRoles.stream().map(TblUserRole::getRoleId).collect(Collectors.toList());
|
|
|
+ }
|
|
|
|
|
|
// 用户登录后,保存用户信息到 session
|
|
|
SaSession saSession = StpUtil.getSession();
|
|
@@ -336,7 +340,7 @@ public class WebGatewayImpl implements WebGateway {
|
|
|
saSession.set(UserConstants.SA_USER_ID, adminUser.getUserId());
|
|
|
saSession.set(UserConstants.SA_USER_TYPE, adminUser.getUserType());
|
|
|
saSession.set(UserConstants.SA_USER_ACCOUNT, adminUser.getAccount());
|
|
|
- saSession.set(UserConstants.SA_USER_ROLE_ID, roleId);
|
|
|
+ saSession.set(UserConstants.SA_USER_ROLE_IDS, roleIds);
|
|
|
if (adminUser.getTenantId() != null) {
|
|
|
saSession.set(UserConstants.SA_USER_TENANT_ID, adminUser.getTenantId());
|
|
|
}
|