package com.jwipc.sys.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jwipc.sys.entity.BusinessAttachment;
import com.jwipc.sys.mapper.BusinessAttachmentMapper;
import com.jwipc.sys.model.po.BusinessAttachmentPO;
import com.jwipc.sys.model.query.BusinessAttachmentQuery;
import com.jwipc.sys.service.IBusinessAttachmentService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  业务附件关系表 服务实现类
 * </p>
 *
 * @author Chen Tianshi
 * @since 2025/9/11 12:13
 */
@Service
public class BusinessAttachmentServiceImpl extends ServiceImpl<BusinessAttachmentMapper, BusinessAttachment> implements IBusinessAttachmentService {
    @Override
    public List<BusinessAttachmentPO> queryByPage(Page<BusinessAttachment> dbPage, BusinessAttachmentQuery query) {
        if (dbPage==null){
            return baseMapper.findPageByQuery(query);
        }
        return baseMapper.findPageByQuery(dbPage,query);
    }

    @Override
    public List<BusinessAttachmentPO> queryByPageByCodes(Page<BusinessAttachment> dbPage, BusinessAttachmentQuery query) {
        if (dbPage==null){
            return baseMapper.findPageByQueryByCodes(query);
        }
        return baseMapper.findPageByQueryByCodes(dbPage,query);
    }

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

    @Override
    public List<BusinessAttachmentPO> getListByBusinessId(Long businessId) {
        return baseMapper.getListByBusinessId(businessId);
    }

    @Override
    public BusinessAttachment getAccountByFileIdAndNotEqId(Long fileId, Long id) {
        return baseMapper.getAccountByFileIdAndNotEqId(fileId,id);
    }

    @Override
    public BusinessAttachment getPurchaseByFileIdAndNotEqId(Long fileId, Long id) {
        return baseMapper.getPurchaseByFileIdAndNotEqId(fileId,id);
    }

    @Override
    public BusinessAttachment getCustomsByFileIdAndNotEqId(Long fileId, Long id) {
        return baseMapper.getCustomsByFileIdAndNotEqId(fileId,id);
    }

    @Override
    public BusinessAttachment getPaymentNoticeByFileIdAndNotEqId(Long fileId, Long id) {
        return baseMapper.getPaymentNoticeByFileIdAndNotEqId(fileId,id);
    }

    @Override
    public BusinessAttachmentPO getDeliveryByPurchaseCode(String businessCode) {
        return baseMapper.getDeliveryByPurchaseCode(businessCode);
    }
}
