package com.hai.dao;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

/**
 * mapper扩展类
 */
public interface HighActivityInfoMapperExt {

    @Select(
            " SELECT" +
            " b.*" +
            " FROM" +
            " high_activity_partake_rule a," +
            " high_activity_info b" +
            " WHERE" +
            " a.activity_info_id = b.id " +
            " AND a.product_type = 1 " +
            " AND a.product_id = #{couponId} " +
            " AND b.`status` = 2" +
            " AND NOW() >= b.start_time " +
            " AND NOW() <= b.end_time" +
            " ORDER BY create_time desc" +
            " LIMIT 1"
    )
    /**
     * 根据卡券查询最新一条活动信息
     * @param couponId 卡券id
     * @return
     */
    Map<String,Object> selectNewActivityByCouponId(@Param("couponId") Long couponId);
}
