/*
 * Copyright (c) 2018-2999 广州亚米信息科技有限公司 All rights reserved.
 *
 * https://www.gz-yami.com/
 *
 * 未经允许，不可做商业用途！
 *
 * 版权所有，侵权必究！
 */

package com.yami.shop.discount.comment.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yami.shop.bean.app.dto.DiscountDto;
import com.yami.shop.bean.app.dto.ProductDto;
import com.yami.shop.bean.model.Product;
import com.yami.shop.bean.param.ProductParam;
import com.yami.shop.common.util.PageParam;
import com.yami.shop.discount.comment.model.Discount;
import com.yami.shop.discount.comment.model.DiscountProd;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface DiscountMapper extends BaseMapper<Discount> {

    Discount getDiscountAndItemAndProdById(@Param("discountId") Long discountId);

    List<Discount> getDiscountsAndItemsByShopId(@Param("shopId") Long shopId);

    int deleteDiscounts(@Param("id") Long id, @Param("shopId") Long shopId);

    List<DiscountDto> listByProdId(@Param("prodId") Long prodId, @Param("shopId") Long shopId);

    IPage<ProductDto> discountProdList(PageParam<ProductDto> page, @Param("discountId") Long discountId);

    IPage<Discount> getPlatformDiscountPage(@Param("page") PageParam<Discount> page, @Param("discount") Discount discount);

    int updateStatusByDiscountId(@Param("discountId") Long discountId, @Param("status") Integer status);


    IPage<DiscountDto> getDiscountList(PageParam<Discount> page);

    DiscountDto getDiscountByDiscountId(@Param("discountId") Long discountId);

    void closeDiscountBySetStatus();

    Integer countProdIsSeckillAll(@Param("shopId") Long shopId, @Param("prodId") Long prodId);

    Integer countProdIsSeckillSome(@Param("shopId") Long shopId,@Param("prodId") Long prodId);

    Integer countProdIsSeckillExcept(@Param("shopId") Long shopId, @Param("prodId") Long prodId);

    List<DiscountProd> getProdIsSeckillExcept(@Param("shopId") Long shopId);

    IPage<Product> pageProdByDiscount(PageParam<Product> page, @Param("product") ProductParam product, @Param("discount") Discount discount);
}
