diff --git a/src/main/java/jty/expressdistributionsystem/controller/AdminController.java b/src/main/java/jty/expressdistributionsystem/controller/AdminController.java index 6b18fd5..51b7f85 100644 --- a/src/main/java/jty/expressdistributionsystem/controller/AdminController.java +++ b/src/main/java/jty/expressdistributionsystem/controller/AdminController.java @@ -7,7 +7,9 @@ import jty.expressdistributionsystem.DTO.ExpressListDTO; import jty.expressdistributionsystem.DTO.SendMessageDTO; import jty.expressdistributionsystem.entity.*; import jty.expressdistributionsystem.service.*; +import jty.expressdistributionsystem.utils.GetIdUtil; import jty.expressdistributionsystem.utils.SendMessageUtil; +import jty.expressdistributionsystem.utils.ThreadLocalUtil; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; import org.springframework.web.bind.annotation.*; @@ -82,6 +84,24 @@ public class AdminController { return new Result<>(200, "发送成功", ""); } + // 获取正在留言的人的所有聊天记录 + @GetMapping("/allMessage") + public Result>> getAllMessage(@RequestParam Long toId) { + Long meId = GetIdUtil.getId(); + LambdaQueryWrapper messageLambdaQueryWrapper = new LambdaQueryWrapper<>(); + List> list = new ArrayList<>(); + // 先获取自己发给那个人的 + messageLambdaQueryWrapper.eq(Message::getSendUserId, meId) + .eq(Message::getGetUserId, toId); + list.add(messageService.list(messageLambdaQueryWrapper)); + // 再获取别人发给自己的 + messageLambdaQueryWrapper.clear(); + messageLambdaQueryWrapper.eq(Message::getGetUserId, meId) + .eq(Message::getSendUserId, toId); + list.add(messageService.list(messageLambdaQueryWrapper)); + return new Result<>(200, "", list); + } + // 管理员获取所有快递信息 @GetMapping("/express") public Result> getAllExpress(@RequestParam int page, @RequestParam int pageSize) {