From cd767dce6f7626062c55f3444c070ebcededf46f Mon Sep 17 00:00:00 2001 From: xupei Date: Wed, 24 Dec 2025 11:47:11 +0800 Subject: [PATCH] =?UTF-8?q?BUGFIX:=E6=96=B0=E7=94=A8=E6=88=B7=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E8=8E=B7=E5=8F=96=E5=8E=86=E5=8F=B2=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ai/da/mapper/primary/NotificationMapper.java | 3 ++- .../com/ai/da/service/impl/MessageCenterServiceImpl.java | 9 +++++++-- src/main/resources/mapper/primary/NotificationMapper.xml | 3 ++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/ai/da/mapper/primary/NotificationMapper.java b/src/main/java/com/ai/da/mapper/primary/NotificationMapper.java index bdce12a3..92a0035c 100644 --- a/src/main/java/com/ai/da/mapper/primary/NotificationMapper.java +++ b/src/main/java/com/ai/da/mapper/primary/NotificationMapper.java @@ -4,6 +4,7 @@ import com.ai.da.common.config.mybatis.plus.CommonMapper; import com.ai.da.mapper.primary.entity.Notification; import java.time.LocalDateTime; +import java.util.Date; import java.util.List; import java.util.Map; @@ -20,5 +21,5 @@ public interface NotificationMapper extends CommonMapper { void setPersonalNotificationAllRead(String type, Long receiverId, LocalDateTime time); - List getUnreadSysNotification(Long accountId); + List getUnreadSysNotification(Long accountId, Date createTime); } 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 685b3264..19927bdb 100644 --- a/src/main/java/com/ai/da/service/impl/MessageCenterServiceImpl.java +++ b/src/main/java/com/ai/da/service/impl/MessageCenterServiceImpl.java @@ -79,6 +79,7 @@ public class MessageCenterServiceImpl extends ServiceImpl wrapper .isNull(Notification::getReceiverId) .or() @@ -103,7 +105,7 @@ public class MessageCenterServiceImpl extends ServiceImpl notificationPage = baseMapper.selectPage(new Page<>(getNotificationDTO.getPage(), getNotificationDTO.getSize()), queryWrapper); - List unreadSysNotificationIds = baseMapper.getUnreadSysNotification(accountId); + List unreadSysNotificationIds = baseMapper.getUnreadSysNotification(accountId, account.getCreateDate()); IPage convert = notificationPage.convert(o -> { NotificationVO notificationVO = CopyUtil.copyObject(o, NotificationVO.class); Account senderAccount = accountService.getById(notificationVO.getSenderId()); @@ -247,9 +249,11 @@ public class MessageCenterServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); queryWrapper.lambda().eq(Notification::getType, "system") + .gt(Notification::getCreateTime, account.getCreateDate()) .and(wrapper -> wrapper .isNull(Notification::getReceiverId) .or() @@ -302,6 +306,7 @@ public class MessageCenterServiceImpl extends ServiceImpl unreadSysNotificationIds = baseMapper.getUnreadSysNotification(accountId); + List unreadSysNotificationIds = baseMapper.getUnreadSysNotification(accountId, account.getCreateDate()); // 2、将未读的设为已读 if (!unreadSysNotificationIds.isEmpty()) setReadStatusSystem(unreadSysNotificationIds); } diff --git a/src/main/resources/mapper/primary/NotificationMapper.xml b/src/main/resources/mapper/primary/NotificationMapper.xml index 27c59370..905b6c4f 100644 --- a/src/main/resources/mapper/primary/NotificationMapper.xml +++ b/src/main/resources/mapper/primary/NotificationMapper.xml @@ -60,7 +60,8 @@ SELECT system_notification_id FROM `t_sys_notification_read_status` WHERE account_id = #{accountId} - ) + ) + AND create_time > #{createTime}