package com.webchat.repository.dao.lottery;

import com.webchat.repository.entity.lottery.LotteryItemEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author 程序员七七
 * @webSite https://www.coderutil.com
 * @Date 2022/11/16 23:49
 * @description
 */
@Repository
public interface ILotteryItemDAO extends JpaSpecificationExecutor<LotteryItemEntity>,
        JpaRepository<LotteryItemEntity, Long> {

    /**
     * 根据活动id查询奖品列表
     * @param activityId
     * @return
     */
    List<LotteryItemEntity> findAllByActivityIdOrderBySlotAsc(String activityId);

    /**
     * 查询活动下奖品数量
     * @param activityId
     * @return
     */
    Long countByActivityId(String activityId);
    Long countByActivityIdAndSlot(String activityId, int slot);
}
