package com.bailuntec.mapper;

import com.bailuntec.domain.entity.*;
import com.bailuntec.domain.example.DcBaseStockRecordExample;
import org.apache.ibatis.annotations.Param;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * 根据仓库、sku，入库时间升序查询入库sku记录
     * @param bailunSku
     * @param warehouseCode
     * @return
     */
    List<DcBaseStockRecord> selectByStockTime(@Param("bailunSku")String bailunSku, @Param("warehouseCode")String warehouseCode);

    List<DcBaseStockRecord> selectPageByGroup(@Param("pageIndex") Integer pageIndex, @Param("pageSize") Integer pageSize);

    /**
     *  根据仓库、sku分组计算入库数量
     * @param jobPointLog
     * @return
     */
    Integer selectCountByGroup(JobPointLog jobPointLog);

    Integer selectOrderPickCount(JobPointLog jobPointLog);

    Integer selectPurchaseInboundCount(JobPointLog jobPointLog);

    Integer selectTransferCount(JobPointLog jobPointLog);

    List<DcBasePurchaseInbound> selectPurchaseInboundByLimit(@Param("startTime")LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, @Param("pageIndex") Integer pageIndex, @Param("pageSize") Integer pageSize);

    List<DcBaseTransferComplete> selectTransferCompleteByLimit(@Param("startTime")LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, @Param("pageIndex") Integer pageIndex, @Param("pageSize") Integer pageSize);

    List<DcBaseOmsPick> selectOrderPickByLimit(@Param("startTime")LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, @Param("pageIndex") Integer pageIndex, @Param("pageSize") Integer pageSize);
}