mirror of
https://github.com/zongzibinbin/MallChat.git
synced 2026-03-13 21:53:41 +08:00
fix: 修复艾特用户列表不在群聊之中的问题
This commit is contained in:
@@ -3,7 +3,9 @@ package com.abin.mallchat.common.chat.dao;
|
||||
import com.abin.mallchat.common.chat.domain.entity.GroupMember;
|
||||
import com.abin.mallchat.common.chat.domain.enums.GroupRoleEnum;
|
||||
import com.abin.mallchat.common.chat.mapper.GroupMemberMapper;
|
||||
import com.abin.mallchat.common.chat.service.cache.GroupMemberCache;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@@ -20,6 +22,9 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class GroupMemberDao extends ServiceImpl<GroupMemberMapper, GroupMember> {
|
||||
|
||||
@Autowired
|
||||
private GroupMemberCache groupMemberCache;
|
||||
|
||||
public List<Long> getMemberUidList(Long groupId) {
|
||||
List<GroupMember> list = lambdaQuery()
|
||||
.eq(GroupMember::getGroupId, groupId)
|
||||
@@ -50,4 +55,16 @@ public class GroupMemberDao extends ServiceImpl<GroupMemberMapper, GroupMember>
|
||||
.eq(GroupMember::getRole, GroupRoleEnum.LEADER.getType())
|
||||
.list();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断用户是否在房间中
|
||||
*
|
||||
* @param roomId 房间ID
|
||||
* @param uidList 用户ID
|
||||
* @return 是否在群聊中
|
||||
*/
|
||||
public Boolean isGroupShip(Long roomId, List<Long> uidList) {
|
||||
List<Long> memberUidList = groupMemberCache.getMemberUidList(roomId);
|
||||
return memberUidList.containsAll(uidList);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user