From 70c26a5ea88c2f977641f5777aad021e7bd7a921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=82=85=E5=93=A5?= <184172133@qq.com> Date: Fri, 23 Jun 2023 16:24:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E5=82=85=E5=93=A5=EF=BC=8Cfeat?= =?UTF-8?q?=EF=BC=9A=E6=9E=B6=E6=9E=84=E7=9A=84=E6=9C=AC=E8=B4=A8=E4=B9=8B?= =?UTF-8?q?=20MVC=20=E6=9E=B6=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xfg/frame/controller/UserController.java | 6 +++--- .../cn/bugstack/xfg/frame/domain/res/UserRes.java | 4 ++-- .../frame/domain/vo/{UserInfo.java => UserVO.java} | 2 +- .../cn/bugstack/xfg/frame/service/IUserService.java | 7 +++---- .../xfg/frame/service/impl/UserServiceImpl.java | 12 ++++++------ .../java/cn/bugstack/xfg/frame/test/ApiTest.java | 6 +++--- 6 files changed, 18 insertions(+), 19 deletions(-) rename src/main/java/cn/bugstack/xfg/frame/domain/vo/{UserInfo.java => UserVO.java} (94%) diff --git a/src/main/java/cn/bugstack/xfg/frame/controller/UserController.java b/src/main/java/cn/bugstack/xfg/frame/controller/UserController.java index 87a1af7..a69fc2f 100644 --- a/src/main/java/cn/bugstack/xfg/frame/controller/UserController.java +++ b/src/main/java/cn/bugstack/xfg/frame/controller/UserController.java @@ -2,7 +2,7 @@ package cn.bugstack.xfg.frame.controller; import cn.bugstack.xfg.frame.common.Result; import cn.bugstack.xfg.frame.domain.res.UserRes; -import cn.bugstack.xfg.frame.domain.vo.UserInfo; +import cn.bugstack.xfg.frame.domain.vo.UserVO; import cn.bugstack.xfg.frame.service.IUserService; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.RequestMapping; @@ -25,8 +25,8 @@ public class UserController { public UserRes queryUserInfo() { try { log.info("查询用户信息"); - List userInfoList = userService.queryUserList(); - return UserRes.builder().userInfos(userInfoList).result(Result.buildSuccess()).build(); + List userVOList = userService.queryUserList(); + return UserRes.builder().userVOList(userVOList).result(Result.buildSuccess()).build(); } catch (Exception e) { log.error("查询用户信息失败", e); return UserRes.builder().result(Result.buildSuccess()).build(); diff --git a/src/main/java/cn/bugstack/xfg/frame/domain/res/UserRes.java b/src/main/java/cn/bugstack/xfg/frame/domain/res/UserRes.java index fbb01e9..967560c 100644 --- a/src/main/java/cn/bugstack/xfg/frame/domain/res/UserRes.java +++ b/src/main/java/cn/bugstack/xfg/frame/domain/res/UserRes.java @@ -1,7 +1,7 @@ package cn.bugstack.xfg.frame.domain.res; import cn.bugstack.xfg.frame.common.Result; -import cn.bugstack.xfg.frame.domain.vo.UserInfo; +import cn.bugstack.xfg.frame.domain.vo.UserVO; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -16,6 +16,6 @@ import java.util.List; public class UserRes { private Result result; - private List userInfos; + private List userVOList; } diff --git a/src/main/java/cn/bugstack/xfg/frame/domain/vo/UserInfo.java b/src/main/java/cn/bugstack/xfg/frame/domain/vo/UserVO.java similarity index 94% rename from src/main/java/cn/bugstack/xfg/frame/domain/vo/UserInfo.java rename to src/main/java/cn/bugstack/xfg/frame/domain/vo/UserVO.java index d843cfd..f19932c 100644 --- a/src/main/java/cn/bugstack/xfg/frame/domain/vo/UserInfo.java +++ b/src/main/java/cn/bugstack/xfg/frame/domain/vo/UserVO.java @@ -11,7 +11,7 @@ import java.util.Date; @AllArgsConstructor @NoArgsConstructor @Builder -public class UserInfo { +public class UserVO { /** 用户名称 */ private String userId; diff --git a/src/main/java/cn/bugstack/xfg/frame/service/IUserService.java b/src/main/java/cn/bugstack/xfg/frame/service/IUserService.java index 1fe67cf..06d0b07 100644 --- a/src/main/java/cn/bugstack/xfg/frame/service/IUserService.java +++ b/src/main/java/cn/bugstack/xfg/frame/service/IUserService.java @@ -1,14 +1,13 @@ package cn.bugstack.xfg.frame.service; -import cn.bugstack.xfg.frame.domain.req.UserReq; -import cn.bugstack.xfg.frame.domain.vo.UserInfo; +import cn.bugstack.xfg.frame.domain.vo.UserVO; import java.util.List; public interface IUserService { - List queryUserList(); + List queryUserList(); - UserInfo queryUserInfo(String uId); + UserVO queryUserInfo(String uId); } diff --git a/src/main/java/cn/bugstack/xfg/frame/service/impl/UserServiceImpl.java b/src/main/java/cn/bugstack/xfg/frame/service/impl/UserServiceImpl.java index 998501f..67aa9b3 100644 --- a/src/main/java/cn/bugstack/xfg/frame/service/impl/UserServiceImpl.java +++ b/src/main/java/cn/bugstack/xfg/frame/service/impl/UserServiceImpl.java @@ -2,7 +2,7 @@ package cn.bugstack.xfg.frame.service.impl; import cn.bugstack.xfg.frame.dao.IUserDao; import cn.bugstack.xfg.frame.domain.po.User; -import cn.bugstack.xfg.frame.domain.vo.UserInfo; +import cn.bugstack.xfg.frame.domain.vo.UserVO; import cn.bugstack.xfg.frame.service.IUserService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -19,11 +19,11 @@ public class UserServiceImpl implements IUserService { private IUserDao userDao; @Override - public List queryUserList() { - List userInfoList = new ArrayList<>(); + public List queryUserList() { + List userInfoList = new ArrayList<>(); List users = userDao.queryUserList(); for (User user : users) { - UserInfo userInfo = UserInfo.builder() + UserVO userInfo = UserVO.builder() .userId(user.getUserId()) .userNickname(user.getUserNickname()) .createTime(user.getCreateTime()) @@ -34,9 +34,9 @@ public class UserServiceImpl implements IUserService { } @Override - public UserInfo queryUserInfo(String uId) { + public UserVO queryUserInfo(String uId) { log.info("查询用户信息:{}", uId); - return new UserInfo(); + return new UserVO(); } } diff --git a/src/test/java/cn/bugstack/xfg/frame/test/ApiTest.java b/src/test/java/cn/bugstack/xfg/frame/test/ApiTest.java index f60b0fc..282bc22 100644 --- a/src/test/java/cn/bugstack/xfg/frame/test/ApiTest.java +++ b/src/test/java/cn/bugstack/xfg/frame/test/ApiTest.java @@ -1,6 +1,6 @@ package cn.bugstack.xfg.frame.test; -import cn.bugstack.xfg.frame.domain.vo.UserInfo; +import cn.bugstack.xfg.frame.domain.vo.UserVO; import cn.bugstack.xfg.frame.service.IUserService; import com.alibaba.fastjson.JSON; import lombok.extern.slf4j.Slf4j; @@ -22,8 +22,8 @@ public class ApiTest { @Test public void test_queryUserList() { - List userInfoList = userService.queryUserList(); - log.info("测试结果:{}", JSON.toJSONString(userInfoList)); + List userVOList = userService.queryUserList(); + log.info("测试结果:{}", JSON.toJSONString(userVOList)); } } -- GitLab