update LoginUser.java 增加是否管理员字段
This commit is contained in:
@@ -122,4 +122,9 @@ public class LoginUser {
|
|||||||
return this.realname + "(" + this.username + ")";
|
return this.realname + "(" + this.username + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据配置文件中的adminRoleCode判断
|
||||||
|
*/
|
||||||
|
private Boolean isAdmin;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-2
@@ -1,5 +1,6 @@
|
|||||||
package com.jero.modules.system.service.impl;
|
package com.jero.modules.system.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@@ -40,6 +41,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.AntPathMatcher;
|
import org.springframework.util.AntPathMatcher;
|
||||||
@@ -105,7 +107,8 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
|||||||
private ISysDictItemService sysDictItemService;
|
private ISysDictItemService sysDictItemService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CommonAPI commonAPI;
|
private CommonAPI commonAPI;
|
||||||
|
@Value("${adminRoleCode}")
|
||||||
|
private String adminRoleCode;
|
||||||
@Autowired
|
@Autowired
|
||||||
ISysCategoryService sysCategoryService;
|
ISysCategoryService sysCategoryService;
|
||||||
private static final String ERROR_MSG = "消息模板不存在,模板编码:";
|
private static final String ERROR_MSG = "消息模板不存在,模板编码:";
|
||||||
@@ -128,7 +131,9 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
|||||||
// 添加用户角色
|
// 添加用户角色
|
||||||
Set<String> roleSet = commonAPI.queryUserRoles(loginUser.getUsername());
|
Set<String> roleSet = commonAPI.queryUserRoles(loginUser.getUsername());
|
||||||
loginUser.setRoleIds(StringUtils.join(roleSet, ","));
|
loginUser.setRoleIds(StringUtils.join(roleSet, ","));
|
||||||
|
List<String> adminRoleCodeList = Arrays.asList(adminRoleCode.split(","));
|
||||||
|
// 添加是否管理员
|
||||||
|
loginUser.setIsAdmin(CollectionUtil.containsAny(roleSet, adminRoleCodeList));
|
||||||
return loginUser;
|
return loginUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -439,7 +439,7 @@ oauth:
|
|||||||
draftDepartName: 起草部门
|
draftDepartName: 起草部门
|
||||||
|
|
||||||
# 管理员权限roleCode,多填用英文逗号拼接
|
# 管理员权限roleCode,多填用英文逗号拼接
|
||||||
adminRoleCode: admin
|
adminRoleCode: admin,BZGLY
|
||||||
|
|
||||||
# 文件下载加解密
|
# 文件下载加解密
|
||||||
download:
|
download:
|
||||||
|
|||||||
Reference in New Issue
Block a user