Merge branch 'dev/dev_xp' into dev/3.1_release_merge

This commit is contained in:
2025-11-18 14:10:24 +08:00

View File

@@ -188,7 +188,7 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
ArrayList<Map<String, Object>> resp = new ArrayList<>();
HashMap<String, Object> 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<NotificationMapper, No
}
private Long getUnreadSystemNotification() {
Long accountId = UserContext.getUserHolder().getId();
// 计算总的系统通知数量
QueryWrapper<Notification> 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<SysNotificationReadStatus> wrapper = new QueryWrapper<>();
wrapper.eq("account_id", UserContext.getUserHolder().getId());
wrapper.eq("account_id", accountId);
Long readCount = sysNotificationReadStatusMapper.selectCount(wrapper);
// 计算差