package com.bailuntec.mapper;

import com.bailuntec.domain.entity.DcBaseStock;
import com.bailuntec.domain.example.DcBaseStockExample;
import com.dangdang.ddframe.job.api.ShardingContext;
import org.apache.ibatis.annotations.Param;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     *
     */
    // 慢查询
    @Deprecated
    void supplementOrderSku();

    /**
     *
     */
    // 慢查询
    @Deprecated
    void supplementTransitSku();

    /**
     *
     */
    // 慢查询
    @Deprecated
    void supplementPurchaseSku();

    // 慢查询
    @Deprecated
    void insertDailyStock();

    List<DcBaseStock> listStockById(@Param("v1") int v1, @Param("v2") int v2);

    List<DcBaseStock> listStockByIdPart(@Param("shardingContext") ShardingContext shardingContext, @Param("v1") int v1, @Param("v2") int v2);

    List<DcBaseStock> listStockWarehouseById(@Param("v1") int v1, @Param("v2") int v2, @Param("warehouseCode") String warehouseCode);

    List<DcBaseStock> listParameterStockById(@Param("shardingContext") ShardingContext shardingContext, @Param("v1") int v1, @Param("v2") int v2);

    List<DcBaseStock> listAllStock(@Param("shardingContext") ShardingContext shardingContext, @Param("v1") int v1, @Param("v2") int v2);

    List<DcBaseStock> listWarehouseStockById(@Param("shardingContext") ShardingContext shardingContext, @Param("warehouseCode") String warehouseCode, @Param("v1") int v1, @Param("v2") int v2);

    List<DcBaseStock> listInStockNotInAutoTurnover();

    void updateSkuUnitPrice();

    /**
     * <p>
     * 自动周转列表普通同步库存列表
     * </p>
     *
     * @param shardingContext shardingContext
     * @param pageStart       pageStart
     * @param pageOffset      pageOffset
     * @return 库存列表
     */
    List<DcBaseStock> listNormal(@Param("shardingContext") ShardingContext shardingContext, @Param("pageStart") int pageStart, @Param("pageOffset") int pageOffset);

    long countNormal(@Param("shardingContext") ShardingContext shardingContext);


    /**
     * <p>
     * 自动周转列表特殊同步库存列表
     * </p>
     *
     * @param shardingContext shardingContext
     * @param pageStart       pageStart
     * @param pageOffset      pageOffset
     * @return 库存列表
     */
    List<DcBaseStock> listSpec(@Param("shardingContext") ShardingContext shardingContext, @Param("pageStart") int pageStart, @Param("pageOffset") int pageOffset);

    long countSpec(@Param("shardingContext") ShardingContext shardingContext);


    long countByParam(@Param("shardingContext") ShardingContext shardingContext);

    long countAll(@Param("shardingContext") ShardingContext shardingContext);


    long countByWarehouseCode(@Param("shardingContext") ShardingContext shardingContext);

    /**
     * <p>
     * 补充晚上定时任务的数据 count
     * </p>
     *
     * @param shardingContext shardingContext
     * @param v1              当天凌晨三点
     * @param v2              当天往前一周的零点
     * @return count
     */
    long countIncrement(@Param("shardingContext") ShardingContext shardingContext, @Param("v1") LocalDateTime v1, @Param("v2") LocalDateTime v2);

    /**
     * <p>
     * 补充晚上定时任务的数据
     * </p>
     *
     * @param shardingContext shardingContext
     * @param v1              当天凌晨三点
     * @param v2              当天往前一周的零点
     * @param pageStart       pageStart
     * @param pageOffset      pageOffset
     * @return 补充晚上定时任务的数据
     */
    List<DcBaseStock> increment(@Param("shardingContext") ShardingContext shardingContext,
                                @Param("v1") LocalDateTime v1,
                                @Param("v2") LocalDateTime v2,
                                @Param("pageStart") int pageStart,
                                @Param("pageOffset") int pageOffset);


    List<DcBaseStock> listNeNormal(@Param("shardingContext") ShardingContext shardingContext, int i, Integer pageSize);

    long countNeNormal(@Param("shardingContext") ShardingContext shardingContext);

    /**
     * 需要应用空运头程计算的stock
     *
     * @param shardingContext 分片参数
     * @param pageStart       页码
     * @param pageOffset      分页
     * @return res
     */
    List<DcBaseStock> selectAir(@Param("shardingContext") ShardingContext shardingContext, @Param("pageStart") int pageStart, @Param("pageOffset") int pageOffset);

    /**
     * 需要应用海运头程计算的stock
     *
     * @param shardingContext 分片参数
     * @param pageStart       页码
     * @param pageOffset      分页
     * @return res
     */
    List<DcBaseStock> selectOcean(@Param("shardingContext") ShardingContext shardingContext, @Param("pageStart") int pageStart, @Param("pageOffset") int pageOffset);

    /**
     * 需要应用空运头程计算的stock count
     *
     * @param shardingContext 分片参数
     * @return res
     */
    long countAir(@Param("shardingContext") ShardingContext shardingContext);

    /**
     * 需要应用海运头程计算的stock count
     *
     * @param shardingContext 分片参数
     * @return res
     */
    long countOcean(@Param("shardingContext") ShardingContext shardingContext);

    List<DcBaseStock> selectNew(LocalDateTime localDateTime);
}
