Skip to content

Commit

Permalink
perf: 优化根据 ID 查询用户昵称方法
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles7c committed Jul 19, 2023
1 parent b0b1127 commit 4a8af1f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,14 @@ public interface UserMapper extends BaseMapper<UserDO> {
*/
@Select("SELECT * FROM `sys_user` WHERE `username` = #{username}")
UserDO selectByUsername(@Param("username") String username);

/**
* 根据 ID 查询昵称
*
* @param id
* ID
* @return 昵称
*/
@Select("SELECT `nickname` FROM `sys_user` WHERE `id` = #{id}")
String selectNicknameById(@Param("id") Long id);
}
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public Long countByDeptIds(List<Long> deptIds) {

@Override
public String getNicknameById(Long id) {
return super.getById(id).getNickname();
return baseMapper.selectNicknameById(id);
}

/**
Expand Down

0 comments on commit 4a8af1f

Please sign in to comment.