package com.ym.mec.biz.dal.dao;

import com.ym.mec.biz.dal.dto.HorseRaceLampDto;
import com.ym.mec.biz.dal.dto.SysCouponCodeDto;
import com.ym.mec.common.dal.BaseDAO;
import com.ym.mec.biz.dal.entity.SysCouponCode;
import org.apache.ibatis.annotations.Param;

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

public interface SysCouponCodeDao extends BaseDAO<Long, SysCouponCode> {

    int batchInsert(@Param("couponCodes") List<SysCouponCode> couponCodes);

    /**
     * @describe 统计指定用户指定优惠券的数量
     * @author Joburgess
     * @date 2021/9/8 0008
     * @param userId:
     * @param couponId:
     * @return int
     */
    int countWithUserAndCoupon(@Param("userId") Integer userId,
                               @Param("couponId") Integer couponId);

    List<SysCouponCodeDto> querySysCouponUseList(Map<String, Object> params);
    int countSysCouponUseList(Map<String, Object> params);

    /**
     * 获取优惠券跑马灯
     * @param params
     * @return
     */
    int countHorseRaceLampDtoList(Map<String, Object> params);

    /**
     * 获取优惠券跑马灯
     * @param params
     * @return
     */
    List<HorseRaceLampDto> queryHorseRaceLampDtoList(Map<String, Object> params);

    /**
     * 支付失败退还优惠券
     * @param couponCodeId
     */
    void quit(@Param("couponCodeId") String couponCodeId);

    /**
     * 根据优惠券编号获取优惠券列表详情
     * @param couponIdList
     * @return
     */
    List<SysCouponCodeDto> findByIdList(@Param("couponIdList") List<Integer> couponIdList);

    /**
     * 使用优惠券
     * @param couponIdList
     */
    void use(@Param("couponIdList") List<Integer> couponIdList);
}
