From d236057f2ad25c0cd910a10375851138c2433417 Mon Sep 17 00:00:00 2001 From: xupei Date: Tue, 18 Nov 2025 14:09:58 +0800 Subject: [PATCH] =?UTF-8?q?BUGFIX:=20=E8=8E=B7=E5=8F=96=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E6=9C=AA=E8=AF=BB=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ai/da/service/impl/MessageCenterServiceImpl.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/ai/da/service/impl/MessageCenterServiceImpl.java b/src/main/java/com/ai/da/service/impl/MessageCenterServiceImpl.java index b1652140..b7f40399 100644 --- a/src/main/java/com/ai/da/service/impl/MessageCenterServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/MessageCenterServiceImpl.java @@ -188,7 +188,7 @@ public class MessageCenterServiceImpl extends ServiceImpl> resp = new ArrayList<>(); HashMap data = new HashMap<>(); Long count; - if (!type.equals("system") || Objects.nonNull(receiverId)) { + if (!type.equals("system")) { // 个人未读消息 count = getUnreadCountByType(type, receiverId); } else { @@ -245,14 +245,20 @@ public class MessageCenterServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("type", "system"); + queryWrapper.lambda().eq(Notification::getType, "system") + .and(wrapper -> wrapper + .isNull(Notification::getReceiverId) + .or() + .eq(Notification::getReceiverId, accountId) + ); Long totalSysCount = baseMapper.selectCount(queryWrapper); // 计算单个用户读了多少条系统数据 QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq("account_id", UserContext.getUserHolder().getId()); + wrapper.eq("account_id", accountId); Long readCount = sysNotificationReadStatusMapper.selectCount(wrapper); // 计算差