From 8a149c54b6e54ec2fb0253a0bc12c340fd57780a Mon Sep 17 00:00:00 2001 From: yjxx <1055683039@qq.com> Date: Mon, 11 Nov 2024 18:46:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UserController.java | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/main/java/jty/expressdistributionsystem/controller/UserController.java b/src/main/java/jty/expressdistributionsystem/controller/UserController.java index 0446a9e..5955264 100644 --- a/src/main/java/jty/expressdistributionsystem/controller/UserController.java +++ b/src/main/java/jty/expressdistributionsystem/controller/UserController.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import jakarta.annotation.Resource; +import jakarta.validation.constraints.NotBlank; import jty.expressdistributionsystem.DTO.AddresseeDTO; import jty.expressdistributionsystem.DTO.GoodsDTO; import jty.expressdistributionsystem.DTO.PickUpExpressDTO; @@ -242,9 +243,12 @@ public class UserController { return new Result<>(200, "代取成功", ""); } - // 用户查询快递 + // 用户查询快递(完成) @GetMapping("/query") - public Result queryGoods(@RequestParam Long queryCode, @RequestParam Long queryId) { + public Result queryGoods(@RequestParam String queryCode, @RequestParam Long queryId) { + if (queryCode.isEmpty()) { + return new Result<>(400, "查询失败", null); + } Long id = GetIdUtil.getId(); LambdaQueryWrapper goodsLambdaQueryWrapper = new LambdaQueryWrapper<>(); if (Objects.equals(id, queryId)) { @@ -262,4 +266,20 @@ public class UserController { } } } + + // 用户查询用户信息(完成) + @GetMapping("/queryInfo") + public Result queryInfo(@RequestParam Long otherId) { + User user = userService.getById(otherId); + return new Result<>(200, "", user.getUserName()); + } + + // 用户获取单个快递历史记录(完成) + @GetMapping("/singleHistory") + public Result singleHistory(@RequestParam String goodsId) { + LambdaQueryWrapper recordsLambdaQueryWrapper = new LambdaQueryWrapper<>(); + recordsLambdaQueryWrapper.eq(Records::getGoodsId, goodsId); + Records records = recordsService.getOne(recordsLambdaQueryWrapper); + return new Result<>(200, "", records); + } }