package com.jwipc.finance.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jwipc.finance.entity.CompanyAccountStatement;
import com.jwipc.finance.entity.CompanyAccountStatement;
import com.jwipc.finance.mapper.CompanyAccountStatementMapper;
import com.jwipc.finance.model.po.CompanyAccountStatementPO;
import com.jwipc.finance.model.query.CompanyAccountStatementQuery;
import com.jwipc.finance.service.ICompanyAccountStatementService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 对账模块-公司间销售对账单主表 服务实现类
 * </p>
 *
 * @author shenyang.ou
 * @since 2025-11-18
 */
@Service
public class CompanyAccountStatementServiceImpl extends ServiceImpl<CompanyAccountStatementMapper, CompanyAccountStatement> implements ICompanyAccountStatementService {
    @Override
    public List<CompanyAccountStatementPO> findPageByQuery(Page<CompanyAccountStatement> dbPage, CompanyAccountStatementQuery query) {
        if (dbPage == null) {
            return baseMapper.findPageByQuery(query);
        }
        return baseMapper.findPageByQuery(dbPage, query);
    }

    /**
     * 检查对账单状态
     *
     * @param idList 对账单ID集合
     * @return 结果
     */
    @Override
    public List<CompanyAccountStatement> checkAccountStatementStatus(List<Long> idList) {
        return baseMapper.checkAccountStatementStatus(idList);
    }

    @Override
    public CompanyAccountStatementPO getPoById(Long id) {
        return baseMapper.getPoById(id);
    }

    @Override
    public List<CompanyAccountStatementPO> accountOrApplyList(Page<CompanyAccountStatement> dbPage, CompanyAccountStatementQuery query) {
        if (dbPage == null) {
            return baseMapper.accountOrApplyList(query);
        }
        return baseMapper.accountOrApplyList(dbPage, query);
    }
}
