package com.hai.dao;

import com.hai.entity.HighDiscountPackage;
import com.hai.entity.HighDiscountPackageRecord;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

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


    @Select(
            " SELECT *" +
                    " FROM high_discount_package_record" +
                    " WHERE" +
                    " status = 1 " +
                    " AND sales_type = 2 " +
                    " AND user_id = #{userId} " +
                    " AND DATE_FORMAT(created_time, '%Y%m') = DATE_FORMAT(CURDATE(), '%Y%m'); "
    )
    /**
     * 根据userId 查询当月是否赠送相关优惠券包
     * @param userId 用户id
     * @return
     */
    List<HighDiscountPackageRecord> CheckCouponsMonth(@Param("userId") Long userId , @Param("usingAttribution") Integer usingAttribution);
}
