package com.red.circle.other.infra.database.rds.dao.redpacket;

import com.red.circle.other.infra.database.rds.entity.RoomRedPacketRecordEntity;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 房间红包领取记录DAO
 */
public interface RoomRedPacketRecordDAO {

    /**
     * 插入
     */
    int insert(RoomRedPacketRecordEntity entity);

    /**
     * 查询用户是否已领取
     */
    int existsByPacketIdAndUserId(@Param("packetId") String packetId, @Param("userId") Long userId);

    /**
     * 查询红包的所有领取记录
     */
    List<RoomRedPacketRecordEntity> selectByPacketId(@Param("packetId") String packetId);

    /**
     * 统计红包已领取数量
     */
    Integer countByPacketId(@Param("packetId") String packetId);
}
