package com.m2pool.chat.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.m2pool.chat.dto.ChatRoomDto;
import com.m2pool.chat.entity.ChatRoom;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface ChatRoomMapper  extends BaseMapper<ChatRoom> {


    /**
     * 查询客服的聊天室列表
     * @param ids 要查询的聊天室集合
     * @return
     */
    List<ChatRoomDto> findRoomList(@Param("ids") List<Long> ids, @Param("sendDateTime") LocalDateTime sendDateTime);



    /**
     * 查找当前用户与对应用户是否已存在创建的聊天室
     * @param userEmail 用户邮箱
     * @return
     */
   ChatRoomDto findRoomByUserEmail(@Param("userEmail") String userEmail);

    /**
     * 新增或修改聊天室
     * @param room
     * @return
     */
   int insetOrUpdateRoom(@Param("room") ChatRoom room);
}
