BUGFIX: 获取系统通知未读数
This commit is contained in:
@@ -188,7 +188,7 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
|
|||||||
ArrayList<Map<String, Object>> resp = new ArrayList<>();
|
ArrayList<Map<String, Object>> resp = new ArrayList<>();
|
||||||
HashMap<String, Object> data = new HashMap<>();
|
HashMap<String, Object> data = new HashMap<>();
|
||||||
Long count;
|
Long count;
|
||||||
if (!type.equals("system") || Objects.nonNull(receiverId)) {
|
if (!type.equals("system")) {
|
||||||
// 个人未读消息
|
// 个人未读消息
|
||||||
count = getUnreadCountByType(type, receiverId);
|
count = getUnreadCountByType(type, receiverId);
|
||||||
} else {
|
} else {
|
||||||
@@ -245,14 +245,20 @@ public class MessageCenterServiceImpl extends ServiceImpl<NotificationMapper, No
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Long getUnreadSystemNotification() {
|
private Long getUnreadSystemNotification() {
|
||||||
|
Long accountId = UserContext.getUserHolder().getId();
|
||||||
// 计算总的系统通知数量
|
// 计算总的系统通知数量
|
||||||
QueryWrapper<Notification> queryWrapper = new QueryWrapper<>();
|
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);
|
Long totalSysCount = baseMapper.selectCount(queryWrapper);
|
||||||
|
|
||||||
// 计算单个用户读了多少条系统数据
|
// 计算单个用户读了多少条系统数据
|
||||||
QueryWrapper<SysNotificationReadStatus> wrapper = new QueryWrapper<>();
|
QueryWrapper<SysNotificationReadStatus> wrapper = new QueryWrapper<>();
|
||||||
wrapper.eq("account_id", UserContext.getUserHolder().getId());
|
wrapper.eq("account_id", accountId);
|
||||||
Long readCount = sysNotificationReadStatusMapper.selectCount(wrapper);
|
Long readCount = sysNotificationReadStatusMapper.selectCount(wrapper);
|
||||||
|
|
||||||
// 计算差
|
// 计算差
|
||||||
|
|||||||
Reference in New Issue
Block a user