package com.ym.im.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ym.im.entity.ChatRecord;
import com.ym.im.entity.PullChatRecord;
import com.ym.im.entity.Session;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 聊天记录 Mapper 接口
 * </p>
 *
 * @author 陈俊雄
 * @since 2019-05-28
 */
public interface ChatRecordMapper extends BaseMapper<ChatRecord> {
    int insert(@Param("chat") ChatRecord chatRecord, @Param("index") int index);

    int insertSelective(@Param("chat") ChatRecord chatRecord, @Param("index") int index);

    int updateById(@Param("chat") ChatRecord chatRecord, @Param("index") int index);

    int updateByIdSelective(@Param("chat") ChatRecord chatRecord, @Param("index") int index);

    int updateBatchReceiveTimeById(@Param("chats") List<ChatRecord> chats, @Param("index") int index);

    int updateReceiveTime(@Param("chat") ChatRecord chatRecord, @Param("index") int index);

    ChatRecord selectById(@Param("id") Long id, @Param("index") int index);

    List<ChatRecord> getChatRecord(@Param("pull") PullChatRecord pull, @Param("index") int index);

    ChatRecord getLatestRecord(@Param("userId") Long userId, @Param("merchantId") Long merchantId, @Param("index") int index);

}
