From 7dd2f481ac44fd058f0f175503c9f60a7cb3fbd2 Mon Sep 17 00:00:00 2001 From: yjxx <1055683039@qq.com> Date: Thu, 7 Nov 2024 16:05:12 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=AD=A3=E5=9C=A8=E7=95=99=E8=A8=80=E7=9A=84=E4=BA=BA=E7=9A=84?= =?UTF-8?q?=E6=89=80=E6=9C=89=E8=81=8A=E5=A4=A9=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/AdminController.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) 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) {