package com.yonge.cooleshow.biz.dal.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yonge.cooleshow.biz.dal.entity.ImGroupMember;
import io.rong.models.group.GroupMember;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 群成员表(ImGroupMember)表数据库访问层
 *
 * @author zx
 * @since 2022-03-22 10:45:57
 */
public interface ImGroupMemberDao extends BaseMapper<ImGroupMember> {

    int insertBatch(@Param("entities") List<ImGroupMember> entities);

    void delByGroupId(@Param("groupId") String groupId);

    ImGroupMember findOne(Map<String, Object> params);

    /**
    * @description: 获取所有的群成员列表
     * @param groupId
    * @return java.util.List<io.rong.models.group.GroupMember>
    * @author zx
    * @date 2022/3/23 15:17
    */
    List<GroupMember> queryGroupMember(@Param("groupId") String groupId);

    /**
     * @description: 获取群成员列表
     * @param imGroupId
     * @param userIds
     * @param roleType
     * @return java.util.List<com.yonge.cooleshow.biz.dal.entity.ImGroupMember>
     * @author zx
     * @date 2022/3/23 17:08
     */
    List<ImGroupMember> initImGroupMember(@Param("imGroupId") String imGroupId,
                                           @Param("userIds") Set<Long> userIds,
                                           @Param("roleType") String roleType);

    ImGroupMember findByUserIdAndGroupId(@Param("userId") Long userId, @Param("groupId") String groupId);
}

