update LoginUser.java 增加是否管理员字段
This commit is contained in:
+7
-2
@@ -1,5 +1,6 @@
|
||||
package com.jero.modules.system.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -40,6 +41,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.AntPathMatcher;
|
||||
@@ -105,7 +107,8 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
private ISysDictItemService sysDictItemService;
|
||||
@Autowired
|
||||
private CommonAPI commonAPI;
|
||||
|
||||
@Value("${adminRoleCode}")
|
||||
private String adminRoleCode;
|
||||
@Autowired
|
||||
ISysCategoryService sysCategoryService;
|
||||
private static final String ERROR_MSG = "消息模板不存在,模板编码:";
|
||||
@@ -128,7 +131,9 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
// 添加用户角色
|
||||
Set<String> roleSet = commonAPI.queryUserRoles(loginUser.getUsername());
|
||||
loginUser.setRoleIds(StringUtils.join(roleSet, ","));
|
||||
|
||||
List<String> adminRoleCodeList = Arrays.asList(adminRoleCode.split(","));
|
||||
// 添加是否管理员
|
||||
loginUser.setIsAdmin(CollectionUtil.containsAny(roleSet, adminRoleCodeList));
|
||||
return loginUser;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user