package com.crm.activity.dao.mapper;

import com.crm.rely.backend.model.pojo.table.ActivityRaceRuleTable;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

/**
 * @author y
 * @create 2022/7/19
 */
@Component
public interface ActivityRaceRuleMapper {

    ActivityRaceRuleTable findFirstBySignDateBtAndType(@Param("signDate") Date signDate, @Param("raceType") Integer raceType);

    List<ActivityRaceRuleTable> findAllLimitedByRaceType(@Param("raceType") Integer raceType, @Param("limit") Integer limit);

    ActivityRaceRuleTable getById(Long id);

    ActivityRaceRuleTable findByCustomIdAndRaceTypeAndSerial(@Param("raceType") Integer raceType, @Param("serial") Integer serial);

    Integer getMaxSerialByRaceType(Integer raceType);

    List<ActivityRaceRuleTable> findAllByDateBt(Date date);

    Integer countByStartDateAndEndDateAndRaceType(@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("raceType") Integer raceType);
}
