package com.ruoyi.web.arap.mapper;

import com.ruoyi.web.arap.domain.ArapOffset;
import com.ruoyi.web.arap.domain.ArapOffsetItem;
import com.ruoyi.web.arap.domain.vo.ArapOpenPayVo;
import com.ruoyi.web.arap.domain.vo.ArapOrderOpenVo;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface ArapOffsetMapper {
    int syncOpenPayFromRecv(@Param("orgId") String orgId);
    int syncOpenPayFromRefund(@Param("orgId") String orgId);
    int syncOrderOpenFromDelivery(@Param("orgId") String orgId);
    int syncOrderOpenFromReturn(@Param("orgId") String orgId);

    List<ArapOpenPayVo> selectOpenPayList(ArapOffset query);
    List<ArapOrderOpenVo> selectOrderOpenList(@Param("orgId") String orgId, @Param("custNo") String custNo,
                                              @Param("startDate") Date startDate, @Param("endDate") Date endDate,
                                              @Param("remark") String remark);

    Integer selectTodayMaxSeq(@Param("orgId") String orgId, @Param("dateText") String dateText);

    int insertOffset(ArapOffset entity);
    int insertOffsetItemBatch(@Param("list") List<ArapOffsetItem> list);

    int decreaseOrderOpen(@Param("orgId") String orgId, @Param("docType") String docType, @Param("docNo") String docNo,
                          @Param("amt") java.math.BigDecimal amt, @Param("updateBy") String updateBy);
    int decreaseOpenPay(@Param("id") Long id, @Param("orgId") String orgId, @Param("amt") java.math.BigDecimal amt, @Param("updateBy") String updateBy);

    List<ArapOffset> selectOffsetList(ArapOffset query);
    ArapOffset selectOffsetById(@Param("id") Long id, @Param("orgId") String orgId);
    List<ArapOffsetItem> selectOffsetItems(@Param("offId") Long offId, @Param("orgId") String orgId);

    int markItemReversed(@Param("id") Long id, @Param("orgId") String orgId, @Param("updateBy") String updateBy);
    int increaseOrderOpen(@Param("orgId") String orgId, @Param("docType") String docType, @Param("docNo") String docNo,
                          @Param("amt") java.math.BigDecimal amt, @Param("updateBy") String updateBy);
    int updateOffsetReverseStatus(@Param("offId") Long offId, @Param("orgId") String orgId, @Param("status") String status, @Param("updateBy") String updateBy);
}

