package com.hzs.activity.recommend.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hzs.activity.recommend.param.AcDirectPushUpgradeListParam;
import com.hzs.activity.recommend.vo.AcDirectPushUpgradeListVO;
import com.hzs.common.domain.activity.recommend.AcRecomUpgradeRecord;
import com.hzs.common.domain.activity.recommend.AcRecomUpgradeRecordExt;
import com.hzs.common.domain.sale.order.SaOrder;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * 推荐升级业务表 Mapper 接口
 */
public interface AcRecomUpgradeRecordMapper extends BaseMapper<AcRecomUpgradeRecord> {

    /**
     * 查询活动时间段内撤单记录
     *
     * @param upgradeRecord 推荐升级业务表
     * @return AcRecomUpgradeRecord
     */
    AcRecomUpgradeRecord selectUpgradeRecordByOrderId(AcRecomUpgradeRecordExt upgradeRecord);

    /**
     * 查询推荐的人数 （20230913修改为只要符合升级条件就升级，不考虑那个活动）
     *
     * @param upgradeRecord 推荐升级业务表
     * @return Integer
     */
    List<Long> selectRecommendNumber(AcRecomUpgradeRecordExt upgradeRecord);

    /**
     * 判断会员是否达标并且查询对应订单
     */
    List<SaOrder> listRecomOrder(@Param("pkMember") Long pkMember,
                                 @Param("pkGrade") Integer pkGrade,
                                 @Param("num") Integer num,
                                 @Param("startTime") Date startTime,
                                 @Param("endTime") Date endTime);

    List<AcDirectPushUpgradeListVO> queryList(AcDirectPushUpgradeListParam param);
}
