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.CouponRecommend;
import com.cyksj.model.views.CouponAvailableRecommendView;
import com.cyksj.model.views.CouponRecommendView;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/*
 *项目名: netflix
 *文件名: CouponRecommendMapper
 *创建者: JavaZou
 *创建时间:2022/11/17 18:04
 */
public interface CouponRecommendMapper extends BaseMapper<CouponRecommend> {
	@Update("update coupon_recommend set deleted = false where coupon_id = #{id}")
	void deleteByCouponId(Long id);

	List<CouponAvailableRecommendView> getRecommendCouponList(@Param("userId") Long userId, @Param("isNewUser") Boolean isNewUser);

	Page<CouponRecommendView> getRecommendCouponViewList(@Param("userId") Long userId, @Param("isNewUser") Boolean isNewUser, @Param("page") IPage<CouponRecommendView> page, @Param("couponId") Long couponId);

	/**
	 * 该优惠券是否处于推荐中
	 */
	int checkPresentRecommendByCouponId(Long couponId);

	Coupon getRecommendCouponByGoodsId(Long goodsId);
}
