diff --git a/luoo_user/src/main/java/com/luoo/user/controller/SimpleUserController.java b/luoo_user/src/main/java/com/luoo/user/controller/SimpleUserController.java index 6bcc041..d5df043 100644 --- a/luoo_user/src/main/java/com/luoo/user/controller/SimpleUserController.java +++ b/luoo_user/src/main/java/com/luoo/user/controller/SimpleUserController.java @@ -87,5 +87,12 @@ public class SimpleUserController { authors = authors.stream().map(userInfo -> {userInfo.setAvatar(Constants.RESOURCE_PREFIX + userInfo.getAvatar());return userInfo;}).collect(Collectors.toList()); return Result.success(authors); } + + @ApiOperation(value = "获取用户信息") + @GetMapping("/listByNickName") + @GlobalInterceptor(checkAdminLogin = true) + public Result> getUserInfoList(String nickName) { + return Result.success(userInfoService.getUserInfo(nickName)); + } } diff --git a/luoo_user/src/main/java/com/luoo/user/dao/UserInfoDao.java b/luoo_user/src/main/java/com/luoo/user/dao/UserInfoDao.java index abe09af..89e3e75 100644 --- a/luoo_user/src/main/java/com/luoo/user/dao/UserInfoDao.java +++ b/luoo_user/src/main/java/com/luoo/user/dao/UserInfoDao.java @@ -54,4 +54,6 @@ public interface UserInfoDao extends JpaRepository, JpaSpecifi @Query(value = "select * from tb_user_info where vip_status = 1\n" + " and vip_expire_time < now()", nativeQuery = true) public List getExpireVipList(); + + public List getUserInfosByNickNameLike(String nickName); } diff --git a/luoo_user/src/main/java/com/luoo/user/service/UserInfoService.java b/luoo_user/src/main/java/com/luoo/user/service/UserInfoService.java index ea74db5..b974378 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/UserInfoService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/UserInfoService.java @@ -864,6 +864,14 @@ public class UserInfoService { return userInfoDao.findAllByIsAuthor(1); } + public List getUserInfo(String nickName) { + if (StringUtils.isBlank(nickName)) { + return null; + } else { + return userInfoDao.getUserInfosByNickNameLike(nickName); + } + } + @Transactional(rollbackFor = Exception.class) public String createInvitationCode(String token) { UserLoginDto user = jwtUtil.getUserLoginDto(token);