【7.2.2】antdv3版本获取菜单默认带上前台菜单类型

pull/29/head
fengshuonan 2022-05-08 02:06:28 +08:00
parent 269106402c
commit c8fa801444
3 changed files with 12 additions and 7 deletions

View File

@ -167,8 +167,8 @@ public class LoginController {
* @date 2022/4/8 15:31
*/
@GetResource(name = "新版Antdv3版本的用户信息获取", path = "/v3/userInfo", requiredPermission = false)
public ResponseData<IndexUserInfoV3> userInfoV3() {
return new SuccessResponseData<>(indexUserInfoService.userInfoV3());
public ResponseData<IndexUserInfoV3> userInfoV3(Integer menuFrontType) {
return new SuccessResponseData<>(indexUserInfoService.userInfoV3(menuFrontType));
}
}

View File

@ -35,11 +35,12 @@ import cn.stylefeng.roses.kernel.system.api.pojo.login.v3.IndexUserInfoV3;
public interface IndexUserInfoService {
/**
* url
* Antdv3
*
* @param menuFrontType
* @author fengshuonan
* @date 2020/12/27 19:13
* @date 2022/4/8 15:31
*/
IndexUserInfoV3 userInfoV3();
IndexUserInfoV3 userInfoV3(Integer menuFrontType);
}

View File

@ -25,6 +25,7 @@
package cn.stylefeng.roses.kernel.system.modular.user.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser;
import cn.stylefeng.roses.kernel.auth.api.pojo.login.basic.SimpleRoleInfo;
@ -57,7 +58,7 @@ public class IndexUserInfoServiceImpl implements IndexUserInfoService {
private MenuServiceApi menuServiceApi;
@Override
public IndexUserInfoV3 userInfoV3() {
public IndexUserInfoV3 userInfoV3(Integer menuFrontType) {
// 获取当前登录用户
LoginUser loginUser = LoginContext.me().getLoginUser();
@ -106,7 +107,10 @@ public class IndexUserInfoServiceImpl implements IndexUserInfoService {
indexUserInfoV3.setRoles(buildRoles(loginUser));
// 获取用户菜单和权限信息
indexUserInfoV3.setAuthorities(menuServiceApi.buildAuthorities(MenuFrontTypeEnum.FRONT.getCode()));
if (ObjectUtil.isEmpty(menuFrontType)) {
menuFrontType = MenuFrontTypeEnum.FRONT.getCode();
}
indexUserInfoV3.setAuthorities(menuServiceApi.buildAuthorities(menuFrontType));
// 登录人的ws-url
indexUserInfoV3.setWsUrl(loginUser.getWsUrl());