package com.bailuntec.mapper;

import com.bailuntec.domain.entity.DcBaseOmsSku;
import com.bailuntec.domain.example.DcBaseOmsSkuExample;
import com.bailuntec.domain.pojo.FbaFeeSku;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

public interface DcBaseOmsSkuMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table dc_base_oms_sku
     *
     * @mbg.generated
     */
    long countByExample(DcBaseOmsSkuExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table dc_base_oms_sku
     *
     * @mbg.generated
     */
    int deleteByExample(DcBaseOmsSkuExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table dc_base_oms_sku
     *
     * @mbg.generated
     */
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table dc_base_oms_sku
     *
     * @mbg.generated
     */
    int insert(DcBaseOmsSku record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table dc_base_oms_sku
     *
     * @mbg.generated
     */
    int insertSelective(DcBaseOmsSku record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table dc_base_oms_sku
     *
     * @mbg.generated
     * @project https://github.com/itfsw/mybatis-generator-plugin
     */
    DcBaseOmsSku selectOneByExample(DcBaseOmsSkuExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table dc_base_oms_sku
     *
     * @mbg.generated
     */
    List<DcBaseOmsSku> selectByExample(DcBaseOmsSkuExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table dc_base_oms_sku
     *
     * @mbg.generated
     */
    DcBaseOmsSku selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table dc_base_oms_sku
     *
     * @mbg.generated
     */
    int updateByExampleSelective(@Param("record") DcBaseOmsSku record, @Param("example") DcBaseOmsSkuExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table dc_base_oms_sku
     *
     * @mbg.generated
     */
    int updateByExample(@Param("record") DcBaseOmsSku record, @Param("example") DcBaseOmsSkuExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table dc_base_oms_sku
     *
     * @mbg.generated
     */
    int updateByPrimaryKeySelective(DcBaseOmsSku record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table dc_base_oms_sku
     *
     * @mbg.generated
     */
    int updateByPrimaryKey(DcBaseOmsSku record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table dc_base_oms_sku
     *
     * @mbg.generated
     * @project https://github.com/itfsw/mybatis-generator-plugin
     */
    int upsert(DcBaseOmsSku record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table dc_base_oms_sku
     *
     * @mbg.generated
     * @project https://github.com/itfsw/mybatis-generator-plugin
     */
    int upsertSelective(DcBaseOmsSku record);


    List<FbaFeeSku> listFbaSku(@Param("timeInterval") int timeInterval);

    List<Double> listFbaFee(@Param("bailunSku") String bailunSku, @Param("website") String website, @Param("timeInterval") int timeInterval);

    BigDecimal selectFBAFee(@Param("bailunSku") String bailunSku, @Param("webSite") String webSite, @Param("paidTime") LocalDateTime paidTime);

    @Deprecated
    BigDecimal selectCostPlatformFee(@Param("bailunSku") String bailunSku,
                                     @Param("platformType") String platformType,
                                     @Param("webSite") String webSite,
                                     @Param("originOrderId") String originOrderId);

    DcBaseOmsSku selectOneByCreateTime(@Param("bailunSku") String bailunSku);

    /**
     * <p>
     * 过去过去的sku平均销量
     * </p>
     *
     * @param lowerTime lowerTime
     * @param upperTime upperTime
     * @return sku销量
     */
    BigDecimal omsSkuSellerCount(@Param("lowerTime") LocalDateTime lowerTime,
                                 @Param("upperTime") LocalDateTime upperTime,
                                 @Param("bailunSku") String bailunSku,
                                 @Param("warehouseCode") String warehouseCode,
                                 @Param("days") Integer days);
}
