package com.fs.qw.mapper;


import com.fs.qw.domain.QwRoom;
import com.fs.qw.domain.QwUser;
import com.fs.qw.vo.QwUserVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 企微群Mapper接口
 *
 * @author fs
 * @date 2023-08-23
 */
public interface QwRoomMapper
{
    /**
     * 查询企微群
     *

     */
    public QwRoom selectQwRoomById(Long id);

    /**
     * 查询企微群列表
     *
     * @param qwRoom 企微群
     * @return 企微群集合
     */
    public List<QwRoom> selectQwRoomList(QwRoom qwRoom);

    /**
     * 新增企微群
     *
     * @param qwRoom 企微群
     * @return 结果
     */
    public int insertQwRoom(QwRoom qwRoom);

    /**
     * 修改企微群
     *
     * @param qwRoom 企微群
     * @return 结果
     */
    public int updateQwRoom(QwRoom qwRoom);

    /**
     * 删除企微群
     *
     * @param roomId 企微群ID
     * @return 结果
     */
    public int deleteQwRoomById(Long roomId);

    /**
     * 批量删除企微群
     *
     * @param roomIds 需要删除的数据ID
     * @return 结果
     */
    public int deleteQwRoomByIds(Long[] roomIds);

    @Select("select * from qw_room where room_id = #{roomId} and home_user_id=#{homeUserId}")
    QwRoom selectByHomeUserId(Long roomId,String homeUserId);

    @Select("select qr.* from qw_room qr left join qw_room_member qrm on qr.room_id = qrm.room_id where user_id=#{homeUserId} ")
    List<QwRoom> selectByHome(String homeUserId);

    @Select("select member_list from qw_room where room_id = #{roomId} limit 1 ")
    String selectRoomMemberByRoomId(Long roomId);

    @Select("select admin_list from qw_room where room_id = #{roomId} limit 1 ")
    String selectRoomAdminList(Long roomId);

    @Select("select * from qw_room where room_id = #{roomId} limit 1")
    QwRoom selectRoomByRoomId(Long roomId);
}
