package com.jwipc.finance.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jwipc.finance.entity.PaymentCodApply;
import com.jwipc.finance.entity.PaymentCodApplyDetail;
import com.jwipc.finance.mapper.PaymentCodApplyMapper;
import com.jwipc.finance.model.po.PaymentCodApplyPO;
import com.jwipc.finance.model.query.PaymentApplyHeadQuery;
import com.jwipc.finance.service.IPaymentCodApplyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

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

/**
 * <p>
 * 对账付款申请主表 服务实现类
 * </p>
 *
 * @author WT
 * @since 2024-03-08
 */
@Service
public class PaymentCodApplyServiceImpl extends ServiceImpl<PaymentCodApplyMapper, PaymentCodApply> implements IPaymentCodApplyService {

    @Override
    public List<PaymentCodApplyPO> selectListByPage(Page<PaymentCodApply> dbPage, PaymentApplyHeadQuery query) {
        if (dbPage==null){
            return baseMapper.selectListByPage(query);
        }
        return baseMapper.selectListByPage(dbPage,query);
    }

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

    @Override
    public List<PaymentCodApply> findAppDetailByAccountStatementNo(String accountStatementNo) {
        return baseMapper.findAppDetailByAccountStatementNo(accountStatementNo);
    }

    @Override
    public List<PaymentCodApply> findDataBySupplierAndAmount(String supplierCode, BigDecimal applyPaymentAmount, Integer monthNum,Long id) {
        return baseMapper.findDataBySupplierAndAmount(supplierCode,applyPaymentAmount, monthNum,id);
    }

    /**
     * 根据供应商、对账单、金额查询
     *
     * @param supplierCode
     * @param accountStatementNo
     * @param budOutMoney
     * @return
     */
    @Override
    public List<PaymentCodApplyDetail> findDataBySupplierAndAccountAndAmount(String supplierCode, String accountStatementNo, BigDecimal budOutMoney,Long id) {
        return baseMapper.findDataBySupplierAndAccountAndAmount(supplierCode,accountStatementNo, budOutMoney,id);
    }
}
