mirror of
https://github.com/zongzibinbin/MallChat.git
synced 2026-03-14 22:23:42 +08:00
feat: 增加显示群主和管理员的功能
This commit is contained in:
@@ -5,10 +5,14 @@ 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 io.swagger.models.auth.In;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -23,6 +27,7 @@ import java.util.stream.Collectors;
|
||||
public class GroupMemberDao extends ServiceImpl<GroupMemberMapper, GroupMember> {
|
||||
|
||||
@Autowired
|
||||
@Lazy
|
||||
private GroupMemberCache groupMemberCache;
|
||||
|
||||
public List<Long> getMemberUidList(Long groupId) {
|
||||
@@ -42,6 +47,22 @@ public class GroupMemberDao extends ServiceImpl<GroupMemberMapper, GroupMember>
|
||||
return list.stream().map(GroupMember::getUid).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量获取成员群角色
|
||||
*
|
||||
* @param groupId 群ID
|
||||
* @param uidList 用户列表
|
||||
* @return 成员群角色列表
|
||||
*/
|
||||
public Map<Long, Integer> getMemberMapRole(Long groupId, List<Long> uidList) {
|
||||
List<GroupMember> list = lambdaQuery()
|
||||
.eq(GroupMember::getGroupId, groupId)
|
||||
.in(GroupMember::getUid, uidList)
|
||||
.select(GroupMember::getUid, GroupMember::getRole)
|
||||
.list();
|
||||
return list.stream().collect(Collectors.toMap(GroupMember::getUid, GroupMember::getRole));
|
||||
}
|
||||
|
||||
public GroupMember getMember(Long groupId, Long uid) {
|
||||
return lambdaQuery()
|
||||
.eq(GroupMember::getGroupId, groupId)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.abin.mallchat.common.user.domain.vo.response.ws;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
@@ -17,6 +18,7 @@ import java.util.Date;
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class ChatMemberResp {
|
||||
@ApiModelProperty("uid")
|
||||
private Long uid;
|
||||
@@ -25,6 +27,12 @@ public class ChatMemberResp {
|
||||
*/
|
||||
@ApiModelProperty("在线状态 1在线 2离线")
|
||||
private Integer activeStatus;
|
||||
|
||||
/**
|
||||
* 角色ID
|
||||
*/
|
||||
private Integer roleId;
|
||||
|
||||
@ApiModelProperty("最后一次上下线时间")
|
||||
private Date lastOptTime;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user