package com.iformall.mapper;

import java.util.*;
import com.iformall.common.CommonMapper;
import com.iformall.domain.po.WxCouponSend;
import com.iformall.domain.vo.WxCouponSendVo;
import org.apache.ibatis.annotations.Param;

public interface WxCouponSendMapper extends CommonMapper<WxCouponSend, String> {

	List<WxCouponSendVo> findListVo(WxCouponSend wxCouponSend);
	List<WxCouponSendVo> findListVoByValidType(WxCouponSend wxCouponSend);

	void updateStatusByCouponId(WxCouponSend wxCouponSend);

	void offExpiriedCouponSendByCouponStatus();

	void updateBirthdayConfig(WxCouponSend wxCouponSend);

	/**
	 * 商户注券 库存减少
	 *
	 * @param id              券ID
	 * @param merchantRemain  当前库存
	 * @param merchantSend    当前已发数
	 * @param number          减少数量
	 */
	Integer reduceMerchantSend(Long id, Integer merchantRemain,Integer merchantSend,Integer number);

	/**
	 * 商户注券 库存退回
	 *
	 * @param id              券ID
	 * @param merchantRemain  当前库存
	 * @param merchantSend    当前已发数
	 * @param number          回退数量
	 */
	Integer backMerchantSend(Long id, Integer merchantRemain, Integer merchantSend,Integer number);

}
