package com.bailuntec.mapper;

import com.bailuntec.domain.dto.DateTurnover;
import com.bailuntec.domain.dto.SalesDetailItem;
import com.bailuntec.domain.entity.SalesDayConfig;
import com.bailuntec.domain.example.SalesDayConfigExample;
import org.apache.ibatis.annotations.Param;

import java.util.List;

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

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

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

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

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

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

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

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

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

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

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

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

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

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


    List<SalesDayConfig> selectByDays(@Param("salesDetailItemList") List<SalesDetailItem> salesDetailItemList,
                                      @Param("bailunSku") String bailunSku,
                                      @Param("warehouseCode") String warehouseCode);

    List<SalesDayConfig> selectTarget();

    List<SalesDayConfig> selectByDays2(@Param("salesDetailItemList") List<DateTurnover> salesDetailItemList,
                                       @Param("bailunSku") String bailunSku,
                                       @Param("warehouseCode") String warehouseCode);

    /**
     * 查询时间最远的一个销量配置
     *
     * @param bailunSku     bailun sku
     * @param warehouseCode warehouse code
     * @return 时间最远的一个销量配置
     */
    SalesDayConfig selectFarthest(@Param("bailunSku") String bailunSku, @Param("warehouseCode") String warehouseCode);
}
