package com.jwipc.finance.logic.impl;

import com.jwipc.finance.convert.CompanyAccountStatementDetailConvert;
import com.jwipc.finance.dto.CompanyAccountStatementDetailDTO;
import com.jwipc.finance.logic.CompanyAccountStatementDetailLogic;
import com.jwipc.finance.model.po.CompanyAccountStatementDetailPO;
import com.jwipc.finance.service.ICompanyAccountStatementDetailService;
import com.jwipc.page.PageUtil;
import com.jwipc.page.PageView;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author shenyang.ou
 * @date 2025/11/4 15:03
 * @desc
 */
@Service
@RequiredArgsConstructor
public class CompanyAccountStatementDetailLogicImpl implements CompanyAccountStatementDetailLogic {
    private final ICompanyAccountStatementDetailService costAccountStatementDetailService;
    private final CompanyAccountStatementDetailConvert companyAccountStatementDetailConvert;
    @Override
    public PageView findByStatementIdPage(Long asId) {
        List<CompanyAccountStatementDetailPO> list = costAccountStatementDetailService.findByStatementId(asId);
        return PageUtil.getPV(list, list.size());
    }

    @Override
    public List<CompanyAccountStatementDetailDTO> findByStatementId(Long asId) {
        List<CompanyAccountStatementDetailPO> list = costAccountStatementDetailService.findByStatementId(asId);
        return companyAccountStatementDetailConvert.po2DTOList(list);
    }
}
