package com.oqpo.api.mapper.pomng;


import com.oqpo.api.entity.pomng.PchOdrBaseInfoEntity;
import com.oqpo.api.entity.pomng.PchOdrDtlPtclEntity;
import com.oqpo.api.entity.pomng.PchReqBaseInfoEntity;
import com.oqpo.api.entity.pomng.PchReqDtlPtclEntity;
import com.oqpo.api.web.dto.request.GridRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface PchOrdMapper {
    List<PchOdrBaseInfoEntity> selectRecPchInitInfo(@Param("brandId") String brandId, List<PchOdrDtlPtclEntity> gridUpdateData)throws Exception;
    List<PchOdrDtlPtclEntity> selectRecPchDtlInitInfo(@Param("brandId") String brandId, List<PchOdrDtlPtclEntity> gridUpdateData)throws Exception;
    PchOdrBaseInfoEntity selectPoInitInfo(@Param("brandId") String brandId)throws Exception;
    PchOdrDtlPtclEntity selectPoPchDtlSaveInfo(@Param("pchReqUnqNo") String pchReqUnqNo, @Param("pchReqDtlNo") String pchReqDtlNo)throws Exception;
    PchOdrDtlPtclEntity selectPoItemDtlSaveInfo(@Param("brandId") String brandId, @Param("itemId") String itemId, @Param("brandUnitUnqNo") String brandUnitUnqNo)throws Exception;

    int insertPchOdrBaseInfo(@Param("userId") String userId, PchOdrBaseInfoEntity entity)throws Exception;
    int insertPchOdrDtlPtcl(@Param("userId") String userId, List<PchOdrDtlPtclEntity> gridInsertData)throws Exception;

    List<PchOdrBaseInfoEntity>  selectPchOdrGridList(@Param("sBrandId") String sBrandId, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sPchOdrStCd") String sPchOdrStCd, @Param("sSpplyId") String sSpplyId, @Param("sWhsId") String sWhsId, @Param("sItemNm") String sItemNm, GridRequest gridRequest);
    int selectPchOdrGridCnt(@Param("sBrandId") String sBrandId, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sPchOdrStCd") String sPchOdrStCd, @Param("sSpplyId") String sSpplyId, @Param("sWhsId") String sWhsId, @Param("sItemNm") String sItemNm);

    PchOdrBaseInfoEntity selectPchOdrInfo(@Param("pchPodrUnqNo") String pchPodrUnqNo);
    List<PchOdrDtlPtclEntity> selectOdrDtlList(@Param("pchPodrUnqNo") String pchPodrUnqNo);

    List<PchOdrDtlPtclEntity> selectOdrDtlStatusList(@Param("pchPodrUnqNo") String pchPodrUnqNo);

    int updateCancelPodrDtl(@Param("userId") String userId, List<PchOdrDtlPtclEntity> gridUpdateData) throws Exception;
    int updateChgPodrStCd(@Param("userId") String userId, @Param("pchOdrStCd") String pchOdrStCd, @Param("pchPodrUnqNo") String pchPodrUnqNo) throws Exception;

    int updateChangeStPodrDtl(@Param("userId") String userId, List<PchOdrDtlPtclEntity> gridUpdateData) throws Exception;
    int updateChgMultiPodrStCd(@Param("userId") String userId, List<PchOdrBaseInfoEntity> gridUpdateData) throws Exception;

    // 공급사 수주현황
    List<PchOdrBaseInfoEntity> selectSpplyPoGridList(@Param("sBrandId") String sBrandId, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sSpplyId") String sSpplyId, @Param("sWhsId") String sWhsId,@Param("sPchOdrStCd") String sPchOdrStCd, @Param("sItemNm") String sItemNm, GridRequest gridRequest )throws Exception;
    int selectSpplyPoGridCnt(@Param("sBrandId") String sBrandId, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sSpplyId") String sSpplyId, @Param("sWhsId") String sWhsId,@Param("sPchOdrStCd") String sPchOdrStCd, @Param("sItemNm") String sItemNm )throws Exception;

    // 공급사 발주 정보
    PchOdrBaseInfoEntity selectSpplyPchOdrInfo(@Param("brandId") String brandId, @Param("pchPodrUnqNo") String pchPodrUnqNo, @Param("spplyId") String spplyId);
    List<PchOdrDtlPtclEntity> selectSpplyOdrDtlList(@Param("brandId") String brandId, @Param("pchPodrUnqNo") String pchPodrUnqNo, @Param("spplyId") String spplyId);



}
