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

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import com.yonge.cooleshow.biz.dal.entity.ImLiveBroadcastRoomMember;
import com.yonge.cooleshow.biz.dal.wrapper.liveroom.ImLiveBroadcastRoomMemberWrapper;

/**
 * 直播间人员关系表
 * 2023-08-15 15:50:17
 */
@Repository
public interface ImLiveBroadcastRoomMemberMapper extends BaseMapper<ImLiveBroadcastRoomMember> {

	/**
	 * 分页查询
	 * @param page IPage<ImLiveBroadcastRoomMemberWrapper.ImLiveBroadcastRoomMember>
	 * @param param ImLiveBroadcastRoomMemberWrapper.ImLiveBroadcastRoomMemberQuery
	 * @return List<ImLiveBroadcastRoomMemberWrapper.ImLiveBroadcastRoomMember>
	 */
	List<ImLiveBroadcastRoomMember> selectPage(@Param("page") IPage<ImLiveBroadcastRoomMember> page, @Param("param") ImLiveBroadcastRoomMemberWrapper.ImLiveBroadcastRoomMemberQuery param);

    /**
     * 查询房间人数
     *
     * @param roomUid 房间id
     */
    ImLiveBroadcastRoomMemberWrapper.RoomMemberNumDto queryMemberNum(@Param("roomUid") String roomUid);

    /**
     * 修改用户连麦状态
     *
     * @param roomUid          直播房间id
     * @param userId           用户id
     * @param whetherMicStatus 连麦状态
     */
    void userWhetherMic(@Param("roomUid") String roomUid, @Param("userId") Long userId, @Param(
            "whetherMicStatus") Integer whetherMicStatus);

    /**
     * 学生声部
     * @param studentIds 学生编号
     * @return List<ImLiveBroadcastRoomMemberVo>
     */
    List<ImLiveBroadcastRoomMemberWrapper.ImLiveBroadcastRoomMember> selectStudentSubject(@Param("studentIds") List<Integer> studentIds);

    IPage<ImLiveBroadcastRoomMemberWrapper.ImLiveBroadcastRoomMember> queryMemberPage(Page<ImLiveBroadcastRoomMemberWrapper.ImLiveBroadcastRoomMember> pageInfo, @Param("param") Map<String, Object> param);

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

    /**
     * 设置在线状态
     *
     * @param userIds      用户id
     * @param groupId      房间编号
     * @param onlineStatus 状态
     */
    void updateOnlineStatus(@Param("userIds") List<Long> userIds, @Param("groupId") String groupId, @Param(
            "onlineStatus") Integer onlineStatus);
    /**
     * 设置直播状态
     *
     * @param userIds      用户id
     * @param groupId      房间编号
     * @param liveRoomStatus 状态
     */
    void updateLiveRoomStatus(@Param("userIds") List<Long> userIds, @Param("groupId") String groupId, @Param(
            "liveRoomStatus") Integer liveRoomStatus);

    List<ImLiveBroadcastRoomMember> queryMember(@Param("userIds") List<Long> userIds, @Param("groupId") String groupId);
}