package com.jwipc.order.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jwipc.order.entity.PurchaseOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jwipc.order.model.po.PurchaseOrderPO;
import com.jwipc.order.model.query.OrderBatchPrintQuery;
import com.jwipc.order.model.query.PurchaseOrderQuery;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 采购订单 Mapper 接口
 * </p>
 *
 * @author zhangjie
 * @since 2024-03-05
 */
public interface PurchaseOrderMapper extends BaseMapper<PurchaseOrder> {
    /**
     *
     * @param query
     * @return
     */
    List<PurchaseOrderPO> orderList(@Param("query") PurchaseOrderQuery query);

    /**
     * 查询列表
     * @param query
     * @param page
     * @return
     */
    List<PurchaseOrderPO> orderList(@Param("query") PurchaseOrderQuery query, @Param("page") Page<PurchaseOrder> page);

    List<PurchaseOrder> findBatchPrintList(@Param("q") OrderBatchPrintQuery query);


    List<PurchaseOrder> findBatchPrintListCheck(@Param("q") OrderBatchPrintQuery query);

    List<PurchaseOrder> findBatchPrintList(Page<PurchaseOrder> page,@Param("q") OrderBatchPrintQuery query);

    PurchaseOrder getIdByCode(String purchaseGroupCode);

    List<PurchaseOrderPO> findList(@Param("ew")LambdaQueryWrapper<PurchaseOrder> queryWrapper,@Param("query") PurchaseOrderQuery query);

    List<PurchaseOrderPO> findList(Page<PurchaseOrderPO> page, @Param("ew")LambdaQueryWrapper<PurchaseOrder> queryWrapper,@Param("query") PurchaseOrderQuery query);

    List<PurchaseOrderPO> supplierConfirmOrderList();

    /**
     *
     * @param query
     * @return
     */
    List<PurchaseOrderPO> findMonthNGconfirmOrderList(@Param("query") PurchaseOrderQuery query);

    /**
     * 通过供应商编码查找合格的供应商
     * @param supplierCode 供应商编码
     * @return 合格的供应商编码数量
     */
    Integer findQualifiedSupplier(@Param("supplierCode") String supplierCode);

    List<String> findAccountStatementByOrderCode(Long id);
}
