package com.jwipc.finance.mapper;

import com.jwipc.finance.entity.InvoicedApplyDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jwipc.finance.model.po.CreatePcaDetailPO;
import com.jwipc.finance.model.po.InvoicedApplyItemPO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 对账模块-开票申请明细 Mapper 接口
 * </p>
 *
 * @author shenyang.ou
 * @since 2024-03-04
 */
public interface InvoicedApplyDetailMapper extends BaseMapper<InvoicedApplyDetail> {

    /**
     * 获取已经存在开票申请中的对账单明细ID
     *
     * @param supplierCode 供应商编码
     * @param companyCode  公司编码
     * @return 结果
     */
    List<Long> findExistAsdIdByQuery(@Param("supplierCode") String supplierCode, @Param("companyCode") String companyCode);

    List<InvoicedApplyItemPO> providePurchaseConfirm(@Param("iaId") Long iaId);

    /**
     * 根据开票申请ID获取开票申请明细
     *
     * @param iaIdList 开票申请单ID集合
     * @return 结果
     */
    List<InvoicedApplyDetail> findByInvoiceApplyId(@Param("iaIdList") List<Long> iaIdList);

    List<InvoicedApplyDetail> findByInvoiceNo(@Param("invoiceNo") String invoiceNo);

    List<CreatePcaDetailPO> queryCodApplyInvoiceById(@Param("id") Long id);

    List<CreatePcaDetailPO> queryCodApplyInvoiceByAccountStatementNo(@Param("accountStatementNo") String accountStatementNo);

    List<CreatePcaDetailPO> queryCodApplyInvoiceListByAccountStatementNo(@Param("accountStatementNo") String accountStatementNo,@Param("createTime") String createTime);
}
