package com.jwipc.contract.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jwipc.contract.entity.ContractPaymentApply;
import com.jwipc.contract.entity.ContractPaymentApplyDetail;
import com.jwipc.contract.mapper.ContractPaymentApplyMapper;
import com.jwipc.contract.model.po.AttachmentManualCheckPO;
import com.jwipc.contract.model.po.ContractPaymentApplyPO;
import com.jwipc.contract.model.query.ContractPaymentApplyHeadQuery;
import com.jwipc.contract.service.IContractPaymentApplyService;
import org.springframework.stereotype.Service;

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

/**
 * <p>
 * 资产合同付款申请主表 服务实现类
 * </p>
 *
 * @author WT
 * @since 2024-03-08
 */
@Service
public class ContractPaymentApplyServiceImpl extends ServiceImpl<ContractPaymentApplyMapper, ContractPaymentApply> implements IContractPaymentApplyService {

    @Override
    public List<ContractPaymentApplyPO> selectListByPage(Page<ContractPaymentApply> dbPage, ContractPaymentApplyHeadQuery query) {
        if (dbPage==null){
            return baseMapper.selectListByPage(query);
        }
        return baseMapper.selectListByPage(dbPage,query);
    }

    @Override
    public List<ContractPaymentApply> findDataStatusByIdList(List<Long> appIdList) {
        return baseMapper.findDataStatusByIdList(appIdList);
    }

    @Override
    public List<ContractPaymentApply> findDataStatusByContractList(String contractNo,String paymentType) {
        return baseMapper.findDataStatusByContractList(contractNo,paymentType);
    }

    @Override
    public List<AttachmentManualCheckPO> getByBusinessIdAndTypeList(Long id) {
        return baseMapper.getByBusinessIdAndTypeList(id);
    }

    @Override
    public List<ContractPaymentApply> findUnderPaymentByContractCode(String contractCode) {
        return baseMapper.findUnderPaymentByContractCode(contractCode);
    }
//
//    @Override
//    public List<PaymentCodApply> findAppDetailByAccountStatementNo(String accountStatementNo) {
//        return baseMapper.findAppDetailByAccountStatementNo(accountStatementNo);
//    }
//
//    @Override
//    public List<PaymentCodApply> findDataBySupplierAndAmount(String supplierCode, BigDecimal applyPaymentAmount, Integer monthNum) {
//        return baseMapper.findDataBySupplierAndAmount(supplierCode,applyPaymentAmount, monthNum);
//    }

    /**
     * 根据供应商、合同、金额查询
     *
     * @param supplierCode
     * @param contractNo
     * @param budOutMoney
     * @return
     */
    @Override
    public List<ContractPaymentApplyDetail> findDataBySupplierAndAccountAndAmount(String supplierCode, String contractNo, BigDecimal budOutMoney, Long id) {
        return baseMapper.findDataBySupplierAndAccountAndAmount(supplierCode,contractNo, budOutMoney,id);
    }
}
