package com.jsh.erp.datasource.mappers;

import com.jsh.erp.datasource.entities.MaterialExtend;
import com.jsh.erp.datasource.entities.MaterialExtendExample;

import java.math.BigDecimal;
import java.util.List;
import org.apache.ibatis.annotations.Param;

public interface MaterialExtendMapper extends BaseMapperX<MaterialExtend>{
    long countByExample(MaterialExtendExample example);

    int deleteByExample(MaterialExtendExample example);

    int deleteByPrimaryKey(Long id);

    int insert(MaterialExtend record);

    int insertSelective(MaterialExtend record);

    List<MaterialExtend> selectByExample(MaterialExtendExample example);

    MaterialExtend selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") MaterialExtend record, @Param("example") MaterialExtendExample example);

    int updateByExample(@Param("record") MaterialExtend record, @Param("example") MaterialExtendExample example);

    int updateByPrimaryKeySelective(MaterialExtend record);

    int updateByPrimaryKey(MaterialExtend record);

    /**
     * 根据商品id查询拓展行数据集合
     * @param id id数组
     */
    List<MaterialExtend> selectByMId(@Param("id") Long id);

    /**
     * 根据批次号查询拓展行数据
     * @param batchNumber
     * @return
     */
    MaterialExtend selectByBatchNumber(@Param("batchNumber") String batchNumber);

    /**
     * 根据仓库id和商品id查询商品库存
     * @param depotList 仓库id
     * @param mid   商品id
     * @return
     */
    BigDecimal getInventorySumByDepotAndMid(@Param("depotList") List<Long> depotList,
                                            @Param("mid") long mid);

}