Commit f8e8c652 by Lichen

登录接口添加角色信息查询

parent ec78bfb7
......@@ -31,6 +31,7 @@ import com.yizhi.site.application.vo.site.MyItemConfigVO;
import com.yizhi.system.application.constant.SecurityError;
import com.yizhi.system.application.controller.manage.AccountController;
import com.yizhi.system.application.domain.Account;
import com.yizhi.system.application.domain.AuthzRole;
import com.yizhi.system.application.domain.Site;
import com.yizhi.system.application.enums.SecurityReturnCode;
import com.yizhi.system.application.exception.AuthNoManagementException;
......@@ -259,6 +260,16 @@ public class AuthController {
}
/**
* 添加角色信息
* @param retMap
* @param user
*/
private void setAuthInfo(Map<String, Object> retMap, Account user) {
List<AuthzRole> roles = authService.getByAccountId(user.getId());
retMap.put("authList", roles);
}
@ApiOperation(value = "用户登录", notes = "用户登录", extensions = {
@Extension(name = ReturnCode.API_SUB_FLAG, properties = {
@ExtensionProperty(name = SecurityError.LOGIN_INFO_ERROR, value = SecurityError.LOGIN_INFO_ERROR_MSG)})})
......@@ -317,6 +328,8 @@ public class AuthController {
setRetMap(retMap, user, token, context);
//设置签到弹框
setEnableSign(retMap,user,context);
// 添加角色
setAuthInfo(retMap, user);
httpResponse.addHeader(GlobalConstant.TOKEN_HEADER, token);
//设置最后一次登录站点信息
setStudentLastLoginRecordCache(user.getId(), context);
......
......@@ -2,6 +2,7 @@ package com.yizhi.system.application.service;
import com.yizhi.system.application.constant.AuthzConstant;
import com.yizhi.core.application.context.RequestContext;
import com.yizhi.system.application.domain.AuthzRole;
import com.yizhi.system.application.exception.AuthNoManagementException;
import com.yizhi.system.application.exception.AuthNotManageException;
import com.yizhi.system.application.model.AccessSite;
......@@ -111,4 +112,11 @@ public interface AuthService {
*/
public Integer getOverlapUserCount(OrgAccountVo adminManageUserInfo,List<Long> serviceVisibleOrgIds,List<Long> serviceVisibleUserIds,Long siteId,Long companyId);
/**
* 根据用户ID查询关联角色
* @param accountId
* @return
*/
public List<AuthzRole> getByAccountId(Long accountId);
}
......@@ -743,4 +743,9 @@ public class AuthServiceImpl implements AuthService {
}
return allordIds;
}
@Override
public List<AuthzRole> getByAccountId(Long accountId) {
return roleMapper.getByAccountId(accountId);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment