@Component public class UserCache extends Object
| 构造器和说明 |
|---|
UserCache() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
clear()
清除全部用户缓存数据
|
Map<String,Object> |
getByLoginName(String userName)
根据登录名获取用户信息
|
Map<String,Object> |
getByUserName(String userName)
根据用户名从缓存中获取用户信息
|
String |
getLoginName(Long userId)
根据用户ID获取其登录名
|
String |
getNickname(Long userId)
根据用户ID获取其昵称
|
Integer |
getPowerType(Long userId)
获取指定用户ID对应的权限类型
|
Long |
getTenantId(Long userId)
获取指定用户所在的租户ID
|
Map<String,Object> |
getUser(long userId)
获取指定用户ID的简短用户信息
|
String |
getUserAvatar(Long userId)
获取指定用户ID的头像Base64编码
|
Map<String,Object> |
getUserMap(Long userId)
根据用户ID获取完整用户信息
|
String |
getUserName(Long userId)
根据用户ID获取其用户名
|
String |
getUserNo(Long userId)
根据用户ID获取其用户编号
|
List<Map<String,Object>> |
getUsers(List<Long> users)
根据多个用户ID批量获取用户基础信息
|
boolean |
isAdministrator(Long userId)
判断给定用户是否是管理员角色
|
boolean |
isDeveloper(Long userId)
判断给定用户是否是开发者角色
|
boolean |
isLoginEnabled(Long userId)
判断账户是否处于启用状态
|
List<Map<String,Object>> |
list()
获取所有用户列表
|
void |
reload()
刷新整个用户缓存数据(清空后重新加载)
|
void |
reload(Object userId)
根据特定用户ID刷新该用户的缓存数据
|
void |
remove(Object userId)
删除指定用户ID在缓存中的条目
|
@Comment(value="\u83b7\u53d6\u6240\u6709\u7528\u6237\u5217\u8868") public List<Map<String,Object>> list() throws SQLException
SQLException - 数据库查询异常时抛出public Map<String,Object> getByUserName(String userName) throws SQLException
userName - 用户名,用于匹配缓存中的用户记录SQLException - 如果数据库访问出现异常(虽然当前实现未直接使用数据库,但保留异常声明)public Map<String,Object> getByLoginName(String userName) throws SQLException
userName - 用户登录名SQLException - 如果数据库操作发生异常@Comment(value="\u83b7\u53d6\u7528\u6237\u4fe1\u606f") public Map<String,Object> getUser(long userId) throws SQLException
userId - 用户IDSQLException - 数据库查询异常时抛出public List<Map<String,Object>> getUsers(List<Long> users) throws SQLException
users - 用户ID列表SQLException - 数据库查询异常时抛出@Comment(value="\u542f\u52a8\uff0c\u521d\u59cb\u5316\u5230\u7f13\u5b58")
public void reload()
throws SQLException
SQLException - 数据库查询异常时抛出@Comment(value="\u6839\u636e\u7528\u6237id\u521d\u59cb\u5316\u5230\u7f13\u5b58\u4e2d") public void reload(Object userId) throws SQLException
userId - 需要更新的用户IDSQLException - 数据库查询异常时抛出@Comment(value="\u83b7\u53d6\u7528\u6237\u59d3\u540d") public String getNickname(Long userId) throws SQLException
userId - 用户IDSQLException - 数据库查询异常时抛出@Comment(value="\u83b7\u53d6\u7528\u6237\u6743\u9650\u7c7b\u578b") public Integer getPowerType(Long userId) throws SQLException
userId - 用户IDSQLException - 数据库查询异常时抛出@Comment(value="\u83b7\u53d6\u7528\u6237\u59d3\u540d") public String getUserName(Long userId) throws SQLException
userId - 用户IDSQLException - 数据库查询异常时抛出@Comment(value="\u83b7\u53d6\u7528\u6237\u5934\u50cf") public String getUserAvatar(Long userId) throws SQLException
userId - 用户IDSQLException - 数据库查询异常时抛出@Comment(value="\u83b7\u53d6\u7528\u6237\u7f16\u53f7") public String getUserNo(Long userId) throws SQLException
userId - 用户IDSQLException - 数据库查询异常时抛出@Comment(value="\u6839\u636e\u7528\u6237ID\u83b7\u53d6\u767b\u5f55\u540d\u79f0") public String getLoginName(Long userId) throws SQLException
userId - 用户IDSQLException - 数据库查询异常时抛出@Comment(value="\u6839\u636e\u7528\u6237ID\u83b7\u53d6\u7528\u6237\u8be6\u60c5") public Map<String,Object> getUserMap(Long userId) throws SQLException
userId - 用户IDSQLException - 数据库查询异常时抛出@Comment(value="\u662f\u5426\u4e3a\u5f00\u53d1\u4eba\u5458") public boolean isDeveloper(Long userId) throws SQLException
userId - 用户IDSQLException - 数据库查询异常时抛出@Comment(value="\u662f\u5426\u4e3a\u7ba1\u7406\u5458") public boolean isAdministrator(Long userId) throws SQLException
userId - 用户IDSQLException - 数据库查询异常时抛出@Comment(value="\u662f\u5426\u542f\u7528\u5e10\u6237") public boolean isLoginEnabled(Long userId) throws SQLException
userId - 用户IDSQLException - 数据库查询异常时抛出@Comment(value="\u6839\u636e\u7528\u6237ID\u83b7\u53d6\u7528\u6237\u5f53\u524d\u6240\u5728\u79df\u6237ID") public Long getTenantId(Long userId) throws SQLException
userId - 用户IDSQLException - 数据库查询异常时抛出@Comment(value="\u6e05\u7a7a\u7528\u6237\u7f13\u5b58") public void clear()
@Comment(value="\u6839\u636e\u7528\u6237ID\u6e05\u7a7a\u7528\u6237\u7f13\u5b58") public void remove(Object userId)
userId - 用户IDCopyright © 2026. All rights reserved.