package com.fs.live.mapper;

import java.util.List;

import com.fs.live.domain.LiveLotteryRegistration;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 直播抽奖登记Mapper接口
 *
 * @author fs
 * @date 2025-07-17
 */
public interface LiveLotteryRegistrationMapper {
    /**
     * 查询直播抽奖登记
     *
     * @param registrationId 直播抽奖登记主键
     * @return 直播抽奖登记
     */
    LiveLotteryRegistration selectLiveLotteryRegistrationByRegistrationId(Long registrationId);

    /**
     * 查询直播抽奖登记列表
     *
     * @param liveLotteryRegistration 直播抽奖登记
     * @return 直播抽奖登记集合
     */
    List<LiveLotteryRegistration> selectLiveLotteryRegistrationList(LiveLotteryRegistration liveLotteryRegistration);

    /**
     * 新增直播抽奖登记
     *
     * @param liveLotteryRegistration 直播抽奖登记
     * @return 结果
     */
    int insertLiveLotteryRegistration(LiveLotteryRegistration liveLotteryRegistration);

    /**
     * 批量插入抽奖注册记录
     * @param registrationList 抽奖注册记录列表
     * @return 结果
     */
    int insertLiveLotteryRegistrationBatch(List<LiveLotteryRegistration> registrationList);


    /**
     * 修改直播抽奖登记
     *
     * @param liveLotteryRegistration 直播抽奖登记
     * @return 结果
     */
    int updateLiveLotteryRegistration(LiveLotteryRegistration liveLotteryRegistration);

    /**
     * 删除直播抽奖登记
     *
     * @param registrationId 直播抽奖登记主键
     * @return 结果
     */
    int deleteLiveLotteryRegistrationByRegistrationId(Long registrationId);

    /**
     * 批量删除直播抽奖登记
     *
     * @param registrationIds 需要删除的数据主键集合
     * @return 结果
     */
    int deleteLiveLotteryRegistrationByRegistrationIds(Long[] registrationIds);

    @Select("select count(1) from live_lottery_registration where user_id=#{userId} and lottery_id=#{lotteryId}")
    int selectRecord(@Param("userId") Long userId,@Param("lotteryId") Long lotteryId);

    int updateLiveLotteryRegistrationNoId(LiveLotteryRegistration liveLotteryRegistration);
}
