package shop.alien.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import shop.alien.entity.store.ActivitySignInReward;

import java.util.List;
/**
 * 签到奖励配置mapper
 */
@Mapper
public interface ActivitySignRewardMapper extends BaseMapper<ActivitySignInReward> {
    @Select("select * from activity_sign_in_reward asir " +
            "where asir.delete_flag = 0 and asir.day_of_sequence % #{continueDay} = 0 ${ew.customSqlSegment}")
    List<ActivitySignInReward> getActivitySignRewardList(@Param("continueDay") int continueDay, @Param(Constants.WRAPPER) QueryWrapper<ActivitySignInReward> dynamicsWrapper);

    @Select("select * from activity_sign_in_reward asir where asir.delete_flag = 0 and asir.day_of_sequence % #{continueDay} = 0 and activity_id = #{activityId} order by asir.day_of_sequence desc limit 1")
    ActivitySignInReward getActivitySignReward(@Param("continueDay") int continueDay, @Param("activityId") int activityId);
}