package com.yonge.cooleshow.biz.dal.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yonge.cooleshow.biz.dal.entity.CouponIssue;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
import com.yonge.cooleshow.biz.dal.queryInfo.CouponInfoQuery;
import com.yonge.cooleshow.biz.dal.queryInfo.CouponIssueQueryInfo;
import com.yonge.cooleshow.biz.dal.vo.coupon.CouponIssueWrapper;
import com.yonge.cooleshow.biz.dal.wrapper.StatGroupWrapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 * 优惠券发放 Mapper 接口
 * </p>
 *
 * @author Eric
 * @since 2022-09-02
 */
@Repository
public interface CouponIssueMapper extends BaseMapper<CouponIssue> {

    List<CouponIssueWrapper> queryCouponIssueInfo(IPage<CouponIssueWrapper> page, @Param("query") CouponIssueQueryInfo query);

    /**
     * 用户优惠券状态统计
     * @param id 用户ID
     * @param query CouponInfoQuery.CouponStateStatQuery
     * @return List<StatGroupWrapper>
     */
    List<StatGroupWrapper> selectCouponStateStatInfo(@Param("userId") Long id, @Param("record") CouponInfoQuery.CouponStateStatQuery query);

    /**
     * 用户发送优惠券统计
     * @param couponId 优惠券ID
     * @param statQuery CouponInfoQuery.IssueStatQuery
     * @return List<StatGroupWrapper>
     */
    List<StatGroupWrapper> selectCouponIssueStatInfo(@Param("couponId") Long couponId, @Param("record") CouponInfoQuery.IssueStatQuery statQuery);
}
