package com.jwipc.finance.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jwipc.finance.entity.CostAccountStatement;
import com.jwipc.finance.mapper.CostAccountStatementMapper;
import com.jwipc.finance.model.po.CostAccountStatementPO;
import com.jwipc.finance.model.query.CostAccountStatementQuery;
import com.jwipc.finance.service.ICostAccountStatementService;
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-03
 */
@Service
public class CostAccountStatementServiceImpl extends ServiceImpl<CostAccountStatementMapper, CostAccountStatement> implements ICostAccountStatementService {

    @Override
    public List<CostAccountStatementPO> findPageByQuery(Page<CostAccountStatement> dbPage, CostAccountStatementQuery query) {
        if (dbPage == null) {
            return baseMapper.findPageByQuery(query);
        }
        return baseMapper.findPageByQuery(dbPage, query);
    }

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

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

    @Override
    public List<CostAccountStatementPO> accountOrApplyList(Page<CostAccountStatement> dbPage, CostAccountStatementQuery query) {
        if (dbPage == null) {
            return baseMapper.accountOrApplyList(query);
        }
        return baseMapper.accountOrApplyList(dbPage, query);
    }
}
