feat: 用户服务通用接口新增查询用户昵称接口
This commit is contained in:
@@ -35,6 +35,11 @@ public interface CacheNames {
|
||||
*/
|
||||
String SYS_USER_NAME = "sys_user_name#30d";
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
String SYS_NICK_NAME = "sys_nick_name#30d";
|
||||
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
|
||||
@@ -15,4 +15,12 @@ public interface UserService {
|
||||
*/
|
||||
String selectUserNameById(Long userId);
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户昵称
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 用户昵称
|
||||
*/
|
||||
String selectNickNameById(Long userId);
|
||||
|
||||
}
|
||||
|
||||
@@ -482,4 +482,12 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||
return ObjectUtil.isNull(sysUser) ? null : sysUser.getUserName();
|
||||
}
|
||||
|
||||
@Cacheable(cacheNames = CacheNames.SYS_NICK_NAME, key = "#userId")
|
||||
@Override
|
||||
public String selectNickNameById(Long userId) {
|
||||
SysUser sysUser = baseMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
||||
.select(SysUser::getNickName).eq(SysUser::getUserId, userId));
|
||||
return ObjectUtil.isNull(sysUser) ? null : sysUser.getNickName();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user