package com.ycwl.basic.mapper;

import com.ycwl.basic.model.mobile.chat.entity.FaceChatMessageEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface FaceChatMessageMapper {
    Integer maxSeqForUpdate(@Param("conversationId") Long conversationId);

    int insert(FaceChatMessageEntity entity);

    List<FaceChatMessageEntity> listByConversation(@Param("conversationId") Long conversationId,
                                                   @Param("cursor") Integer cursor,
                                                   @Param("limit") Integer limit);

    /**
     * 按 seq 倒序获取最近若干条消息，用于拼接上下文。
     */
    List<FaceChatMessageEntity> listRecentByConversation(@Param("conversationId") Long conversationId,
                                                         @Param("limit") Integer limit);
}
