fix: 其他角色看不到超管

dev
huangfeng 1 year ago
parent 552d407efb
commit b94eeb5614

@ -2,6 +2,7 @@ package com.shxy.xymanager_service.impl;
import com.shxy.xymanager_common.entity.*;
import com.shxy.xymanager_common.exception.ApiException;
import com.shxy.xymanager_common.threadlocal.UserContextHolder;
import com.shxy.xymanager_dao.dao.*;
import com.shxy.xymanager_service.service.RoleService;
import lombok.extern.slf4j.Slf4j;
@ -33,10 +34,13 @@ public class RoleServiceImpl implements RoleService {
TbRoleExample example = new TbRoleExample();
TbRoleExample.Criteria criteria = example.createCriteria();
List<TbRole> list = roleMapper.selectByExample(example);
TbRole item = new TbRole();
item.setId(SUPER_ADMIN);
item.setName(SUPER_ADMIN_NAME);
list.add(0, item);
SysUser sysUser = UserContextHolder.currentUserInfo();
if (sysUser.getRole() == SUPER_ADMIN) {
TbRole item = new TbRole();
item.setId(SUPER_ADMIN);
item.setName(SUPER_ADMIN_NAME);
list.add(0, item);
}
return list;
}

Loading…
Cancel
Save