package com.oqpo.api.mapper.rtnmng;


import com.oqpo.api.entity.pomng.PchReqBaseInfoEntity;
import com.oqpo.api.entity.pomng.PchReqDtlPtclEntity;
import com.oqpo.api.entity.rtnmng.RtnReqBaseInfoEntity;
import com.oqpo.api.entity.rtnmng.RtnReqDtlPtclEntity;
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 RtnReqMapper {


    int insertRtnReqBaseInfo(@Param("userId") String userId,  RtnReqBaseInfoEntity entity) throws Exception;
    int updateRtnReqBaseInfo(@Param("userId") String userId,  RtnReqBaseInfoEntity entity) throws Exception;
    int insertRtnReqDtlPtcl(@Param("userId") String userId, List<RtnReqDtlPtclEntity> gridInsertData) throws Exception;
    int updateRtnReqDtlPtcl(@Param("userId") String userId, List<RtnReqDtlPtclEntity> gridUpdateData) throws Exception;
    int deleteRtnReqDtlPtcl(@Param("rtnReqUnqNo") String rtnReqUnqNo, List<RtnReqDtlPtclEntity> gridDeleteData) throws Exception;
    int selectMaxRtnReqDtlNo(@Param("rtnReqUnqNo") String rtnReqUnqNo) throws Exception;
    RtnReqBaseInfoEntity selectSumRtnAmt(@Param("rtnReqUnqNo") String rtnReqUnqNo) throws Exception;

    List<RtnReqBaseInfoEntity> selectRtnReqGridList(@Param("sBrandId") String sBrandId, @Param("sStoreId") String sStoreId, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sWhsId") String sWhsId, @Param("sRtnReqStCd") String sRtnReqStCd, @Param("sItemNm") String sItemNm, GridRequest gridRequest)throws Exception;
    int selectRtnReqGridCnt(@Param("sBrandId") String sBrandId,@Param("sStoreId") String sStoreId,  @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sWhsId") String sWhsId, @Param("sRtnReqStCd") String sRtnReqStCd, @Param("sItemNm") String sItemNm)throws Exception;


    RtnReqBaseInfoEntity selectRtnReqInfo(@Param("brandId") String brandId, @Param("storeId") String storeId, @Param("rtnReqUnqNo") String rtnReqUnqNo)throws Exception;
    List<RtnReqDtlPtclEntity> selectRtnReqDtlList(@Param("rtnReqUnqNo") String rtnReqUnqNo)throws Exception;


    List<RtnReqBaseInfoEntity> selectRtnReqTargetGridList(@Param("sBrandId") String sBrandId, @Param("sStoreId") String sStoreId, @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sWhsId") String sWhsId, @Param("sSpplyId") String sSpplyId, @Param("sItemNm") String sItemNm, GridRequest gridRequest)throws Exception;
    int selectRtnReqTargetGridCnt(@Param("sBrandId") String sBrandId,@Param("sStoreId") String sStoreId,  @Param("fromDt") String fromDt, @Param("toDt") String toDt, @Param("sWhsId") String sWhsId, @Param("sSpplyId") String sSpplyId, @Param("sItemNm") String sItemNm)throws Exception;

    List<RtnReqBaseInfoEntity> selectRtnRejectPrTargetList(@Param("rtnReqUnqNo") String rtnReqUnqNo);

    int updateRejRtnReqBaseInfo(@Param("userId") String userId, @Param("rtnReqUnqNo") String rtnReqUnqNo, @Param("rtnRjctRsn") String rtnRjctRsn, @Param("rtnRjctNm") String rtnRjctNm) throws Exception;


    int updateRtnReqStCd(@Param("userId") String userId, List<RtnReqBaseInfoEntity> gridUpdateData) throws Exception;

    int updateAllRtnReqDtlStCd(@Param("userId") String userId, @Param("rtnReqUnqNo") String rtnReqUnqNo,  @Param("rtnReqDtlStCd") String rtnReqDtlStCd) throws Exception;

    int selectRtnRejectIngCnt( @Param("rtnReqUnqNo") String rtnReqUnqNo) throws Exception;

    int updateSelRtnReqDtlStCd(@Param("userId") String userId, List<RtnReqDtlPtclEntity> gridUpdateData) throws Exception;

    List<RtnReqDtlPtclEntity> selectRtnReqDtlStatusList( @Param("rtnReqUnqNo") String rtnReqUnqNo) throws Exception;

}
