package com.oqpo.api.mapper.pomng;


import com.oqpo.api.entity.oper.AfflSaleInfoEntity;
import com.oqpo.api.entity.pomng.PchOdrBaseInfoEntity;
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 PchReqMapper {

    List<PchReqBaseInfoEntity> selectPchReqGridList(@Param("sBrandId") String sBrandId, @Param("sStoreId") String sStoreId, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sWhsId") String sWhsId , @Param("sPchReqStCd") String sPchReqStCd , @Param("sItemNm") String sItemNm ,  GridRequest gridRequest)throws Exception;
    int selectPchReqGridCnt(@Param("sBrandId") String sBrandId, @Param("sStoreId") String sStoreId, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sWhsId") String sWhsId , @Param("sPchReqStCd") String sPchReqStCd , @Param("sItemNm") String sItemNm )throws Exception;

    PchReqBaseInfoEntity selectPchReqInfo(@Param("brandId") String brandId, @Param("pchReqUnqNo") String pchReqUnqNo)throws Exception;
    List<PchReqDtlPtclEntity> selectPchReqDtlPtcl(@Param("brandId") String brandId, @Param("pchReqUnqNo") String pchReqUnqNo)throws Exception;


    int insertPchReqBaseInfo(@Param("userId") String userId, @Param("userNm") String userNm, PchReqBaseInfoEntity entity) throws Exception;

    int updateOrdPchReqBaseInfo(@Param("userId") String userId, @Param("userNm") String userNm, PchReqBaseInfoEntity entity) throws Exception;

    int insertPchReqDtlPtcl(@Param("userId") String userId, List<PchReqDtlPtclEntity> gridInsertData) throws Exception;

    int updateRejPchReqBaseInfo(@Param("userId") String userId, @Param("pchReqUnqNo") String pchReqUnqNo, @Param("pchReqRjctNm") String pchReqRjctNm, @Param("pchReqRjctRsn") String pchReqRjctRsn) throws Exception;

    int updatePchReqDtlPtcl(@Param("userId") String userId, @Param("pchReqUnqNo") String pchReqUnqNo, List<PchReqDtlPtclEntity> gridUpdateData) throws Exception;

    int deletePchReqDtlPtcl(@Param("pchReqUnqNo") String pchReqUnqNo, List<PchReqDtlPtclEntity> gridDeleteData ) throws Exception;

    int selectMaxPchReqDtlNo( @Param("pchReqUnqNo") String pchReqUnqNo) throws Exception;

    PchReqBaseInfoEntity selectSumReqAmt(@Param("pchReqUnqNo") String pchReqUnqNo) throws Exception;

    List<PchReqBaseInfoEntity> selectPchReqPoTargetGridList(@Param("sBrandId") String sBrandId, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sSpplyId") String sSpplyId , @Param("sWhsId") String sWhsId , @Param("sItemNm") String sItemNm ,  GridRequest gridRequest)throws Exception;
    int selectPchReqPoTargetGridCnt(@Param("sBrandId") String sBrandId, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sSpplyId") String sSpplyId , @Param("sWhsId") String sWhsId , @Param("sItemNm") String sItemNm )throws Exception;

    List<PchReqDtlPtclEntity> selectPchRejectPrTargetList(@Param("pchReqUnqNo") String pchReqUnqNo) ;

    int updatePchReqStCd(@Param("userId") String userId, List<PchReqBaseInfoEntity> gridUpdateData) throws Exception;
}
