1.已读未读数排除自己
This commit is contained in:
zhongzb
2023-08-20 15:30:36 +08:00
parent 5c0ec34760
commit 68a4296b7b
2 changed files with 2 additions and 1 deletions

View File

@@ -33,6 +33,7 @@ public class ContactDao extends ServiceImpl<ContactMapper, Contact> {
public Integer getReadCount(Message message) {
return lambdaQuery()
.eq(Contact::getRoomId, message.getRoomId())
.ne(Contact::getUid, message.getFromUid())//不需要查询出自己
.ge(Contact::getReadTime, message.getCreateTime())
.count();
}

View File

@@ -66,7 +66,7 @@ public class ContactServiceImpl implements ContactService {
Integer readCount = contactDao.getReadCount(message);
readInfoDTO.setReadCount(readCount);
if (needUnread) {
readInfoDTO.setUnReadCount(finalTotalCount - readCount);
readInfoDTO.setUnReadCount(finalTotalCount - readCount - 1);
}
return readInfoDTO;
}).collect(Collectors.toMap(MsgReadInfoDTO::getMsgId, Function.identity()));