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); + } }