package com.bailuntec.mapper;

import com.bailuntec.domain.dto.OutStockQuantity;
import com.bailuntec.domain.dto.PurchaseTransitQuantity;
import com.bailuntec.domain.dto.TransferTransitQuantity;
import com.bailuntec.domain.entity.DcMidTransit;
import com.bailuntec.domain.example.DcMidTransitExample;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    void calculateTransferTransit(@Param("list") List<TransferTransitQuantity> list, @Param("localDateTime") LocalDateTime localDateTime);

    void calculatePurchaseTransit(@Param("list") List<PurchaseTransitQuantity> list, @Param("localDateTime") LocalDateTime localDateTime);

    void insertMidDailyTransit();

    List<OutStockQuantity> selectQuantityOutStock();
    List<PurchaseTransitQuantity> selectQuantityPurchaseTransit();
    List<TransferTransitQuantity> selectQuantityTransferTransit();

    void calculateOutStock(@Param("list") List<OutStockQuantity> list, @Param("localDateTime") LocalDateTime localDateTime);

    @Select("select @@tx_isolation;")
    String printTransactionLevel();

    void updateOldTransferToZero(@Param("transferModified") String transferModified);
    void updateOldPurchaseToZero(@Param("purchaseModified") String purchaseModified);
    void updateOldOutStockToZero(@Param("outStockModified") String outStockModified);

    LocalDateTime selectMaxOutStockModified();
    LocalDateTime selectMaxTransferModified();
    LocalDateTime selectMaxPurchaseModified();
    LocalDateTime selectMaxUnshippedModified();

    void updateOldUnshippedToZero(@Param("unshippedModified") LocalDateTime unshippedModified);

    void calculateUnshipped();

    void updateSkuUnitPrice();
}