package com.cyksj.mapper.manage.coupon;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cyksj.model.entity.Coupon;
import com.cyksj.model.entity.CouponUser;
import com.cyksj.model.views.CouponActiveView;
import com.cyksj.model.views.CouponUserView;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/*
 *项目名: netflix
 *文件名: CouponUserMapper
 *创建者: JavaZou
 *创建时间:2022/11/18 11:43
 */
public interface CouponUserMapper extends BaseMapper<CouponUser> {
	Page<CouponUserView> getAvailableCouponList(@Param("skuId") Long skuId, @Param("skuMoney") BigDecimal skuMoney, @Param("couponId") Long couponId, @Param("goodsId") Long goodsId, @Param("userId") Long userId, @Param("isRenew") Boolean isRenew, @Param("page") IPage<CouponUserView> page);

	List<CouponUserView> countAvailableCouponList(@Param("goodsId") Long goodsId, @Param("skuId") Long skuId, @Param("userId") Long userId, @Param("isRenew") Boolean isRenew);

	Page<CouponActiveView> couponCenterList(@Param("userId") Long userId, IPage<CouponUserView> page);

	Page<CouponUserView> couponPersonalList(@Param("userId") Long userId, @Param("page") Page<CouponUserView> page, @Param("couponId") Long couponId);

	CouponUserView getNewUserWelfareCouponsByUserId(@Param("userId") long userId, @Param("couponId") Long couponId);

	CouponUser getCouponByCouponUserId(Long couponUserId);

	CouponUserView getCouponDetailById(@Param("userId") long userId, @Param("couponId") Long couponId);

	Map<String, Long> selectCouponUserNumData(Long couponId);

	List<CouponUserView> couponPersonalByCouponIds(@Param("userIds") List<Long> userIds, @Param("couponIds") List<Long> couponIds);

	Coupon selectUserCouponByGidAndPrice(@Param("userId") Long userId, @Param("goodsId") Long goodsId, @Param("price") BigDecimal price);

	Coupon selectUserCouponBySkuId(@Param("userId") Long userId, @Param("skuId") Long skuId);

	Coupon selectNoLoginRecommendCouponReduce(@Param("goodsId") Long goodsId, @Param("price") BigDecimal price);
}
