package com.shinsoft.sto.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shinsoft.sto.model.*;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import com.shinsoft.sto.model.TransRecordAddInfo;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 库存变更记录表 Mapper 接口
 * </p>
 *
 * @author system
 * @since 2024-09-30
 */
public interface TransRecordMapper extends BaseMapper<TransRecord> {

    @Select("SELECT * FROM STO_TRANS_RECORD WHERE ID = #{id}" )
    TransRecord selectByPK(String id);

    /**
     * 获取添加信息
     * @param map
     * @return
     */
    TransRecordAddInfo selectAddInfoByTId(Map<String, String> map);

    /**
     * 修改库存现有量
     * @param map
     */
    void updateOnHand(Map<String, Object> map);

    /**
     * 查询库存现有量是否存在
     * @param havingMap
     * @return
     */
    OnHandVO queryOne(Map<String, Object> havingMap);

    Page<TransRecord> selectList(Page<TransRecord> page1, @Param("storeNm") String storeNm,@Param("itemNm") String itemNm,@Param("itemType") String itemType,@Param("startTime") Date startTime,@Param("endTime") Date endTime);

    /**
     * 修改修改人
     * @param transRecordAddInfo
     */
//    void updateModify(TransRecordAddInfo transRecordAddInfo);

    /**
     * 查询物料收发存
     */
    IPage<TransRecordWlsfc> queryWlsfc (Page<TransRecordWlsfc> autoPage, @Param("map") Map<String, Object> map);
    List<TransRecordWlsfc> queryWlsfcList (Page<TransRecordWlsfc> autoPage, @Param("map") Map<String, Object> map);


    Page<HashMap<String,Object>> selectSum(Page<TransRecord> page1, @Param("transacationDate") Date transacationDate, @Param("todayDate") Date todayDate,@Param("storeNm") String storeNm,@Param("itemType") String itemType,@Param("areaCd") String areaCd,@Param("stackCd") String stackCd,@Param("itemNm") String itemNm);

}
