package com.jwipc.inquiry.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jwipc.inquiry.entity.Inquiry;
import com.jwipc.inquiry.entity.PurchaseApplyBill;
import com.jwipc.inquiry.entity.PurchaseApplyBillDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jwipc.inquiry.model.po.InquiryMaterialPO;
import com.jwipc.inquiry.model.po.PurchaseApplyBillDetailPO;
import com.jwipc.inquiry.model.query.PurchaseApplyBillDetailQuery;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 采购申请明细 Mapper 接口
 * </p>
 *
 * @author shenyang.ou
 * @since 2024-02-29
 */
public interface PurchaseApplyBillDetailMapper extends BaseMapper<PurchaseApplyBillDetail> {

    List<PurchaseApplyBillDetailPO> findPageByQuery(@Param("query") PurchaseApplyBillDetailQuery query);

    List<PurchaseApplyBillDetailPO> findPageByQuery(Page<Inquiry> dbPage, @Param("query") PurchaseApplyBillDetailQuery query);

    List<InquiryMaterialPO> makeInquiryMaterial( @Param("purchaseBillDetailIdList") List<String> purchaseBillDetailIdList);

    List<PurchaseApplyBillDetailPO> findPageByQuerySC(@Param("query") PurchaseApplyBillDetailQuery query);

    List<PurchaseApplyBillDetailPO> findPageByQuerySC(Page<Inquiry> dbPage, @Param("query") PurchaseApplyBillDetailQuery query);

    List<PurchaseApplyBillDetailPO> selectPurchaseForContractList(Page<PurchaseApplyBill> dbPage, @Param("query") PurchaseApplyBillDetailQuery query);

    BigDecimal getPurchaseNumAmountByBillNoAndCode(@Param("purchaseBillCode") String purchaseBillCode, @Param("purchaseBillItemCode") String purchaseBillItemCode, @Param("id") Long id);

}
