mirror of
https://github.com/201206030/novel.git
synced 2025-04-27 07:30:50 +00:00
feat: 增加用户信息查询接口
This commit is contained in:
parent
282755f7ab
commit
6b366348c0
@ -7,6 +7,7 @@ import io.github.xxyopen.novel.dto.req.UserCommentReqDto;
|
||||
import io.github.xxyopen.novel.dto.req.UserInfoUptReqDto;
|
||||
import io.github.xxyopen.novel.dto.req.UserLoginReqDto;
|
||||
import io.github.xxyopen.novel.dto.req.UserRegisterReqDto;
|
||||
import io.github.xxyopen.novel.dto.resp.UserInfoRespDto;
|
||||
import io.github.xxyopen.novel.dto.resp.UserLoginRespDto;
|
||||
import io.github.xxyopen.novel.dto.resp.UserRegisterRespDto;
|
||||
import io.github.xxyopen.novel.service.BookService;
|
||||
@ -46,6 +47,13 @@ public class UserController {
|
||||
return userService.login(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户信息查询接口
|
||||
*/
|
||||
@GetMapping
|
||||
public RestResp<UserInfoRespDto> getUserInfo() {
|
||||
return userService.getUserInfo(UserHolder.getUserId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户信息修改接口
|
||||
|
@ -0,0 +1,30 @@
|
||||
package io.github.xxyopen.novel.dto.resp;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户信息 响应DTO
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* @date 2022/5/22
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class UserInfoRespDto {
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
* */
|
||||
private String nickName;
|
||||
|
||||
/**
|
||||
* 用户头像
|
||||
* */
|
||||
private String userPhoto;
|
||||
|
||||
/**
|
||||
* 用户性别
|
||||
* */
|
||||
private Integer userSex;
|
||||
}
|
@ -4,6 +4,7 @@ import io.github.xxyopen.novel.core.common.resp.RestResp;
|
||||
import io.github.xxyopen.novel.dto.req.UserInfoUptReqDto;
|
||||
import io.github.xxyopen.novel.dto.req.UserLoginReqDto;
|
||||
import io.github.xxyopen.novel.dto.req.UserRegisterReqDto;
|
||||
import io.github.xxyopen.novel.dto.resp.UserInfoRespDto;
|
||||
import io.github.xxyopen.novel.dto.resp.UserLoginRespDto;
|
||||
import io.github.xxyopen.novel.dto.resp.UserRegisterRespDto;
|
||||
|
||||
@ -65,4 +66,11 @@ public interface UserService {
|
||||
* @return 0-不在书架 1-已在书架
|
||||
*/
|
||||
RestResp<Integer> getBookshelfStatus(Long userId, String bookId);
|
||||
|
||||
/**
|
||||
* 用户信息查询
|
||||
* @param userId 用户ID
|
||||
* @return 用户信息
|
||||
*/
|
||||
RestResp<UserInfoRespDto> getUserInfo(Long userId);
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import io.github.xxyopen.novel.dao.mapper.UserInfoMapper;
|
||||
import io.github.xxyopen.novel.dto.req.UserInfoUptReqDto;
|
||||
import io.github.xxyopen.novel.dto.req.UserLoginReqDto;
|
||||
import io.github.xxyopen.novel.dto.req.UserRegisterReqDto;
|
||||
import io.github.xxyopen.novel.dto.resp.UserInfoRespDto;
|
||||
import io.github.xxyopen.novel.dto.resp.UserLoginRespDto;
|
||||
import io.github.xxyopen.novel.dto.resp.UserRegisterRespDto;
|
||||
import io.github.xxyopen.novel.manager.VerifyCodeManager;
|
||||
@ -157,4 +158,14 @@ public class UserServiceImpl implements UserService {
|
||||
: CommonConsts.NO
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RestResp<UserInfoRespDto> getUserInfo(Long userId) {
|
||||
UserInfo userInfo = userInfoMapper.selectById(userId);
|
||||
return RestResp.ok(UserInfoRespDto.builder()
|
||||
.nickName(userInfo.getNickName())
|
||||
.userSex(userInfo.getUserSex())
|
||||
.userPhoto(userInfo.getUserPhoto())
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user