package com.xunhong.erp.turbo.biz.app.executor.query;

import com.xunhong.erp.turbo.api.biz.dto.qry.CompanyPaymentAccountListQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.CompanyPaymentAccountVO;
import com.xunhong.erp.turbo.biz.app.assembler.CompanyPaymentAccountAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.CompanyPaymentAccount;
import com.xunhong.erp.turbo.biz.domain.gateway.CompanyPaymentAccountGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author shenyifei
 */
@Slf4j
@Component
@RequiredArgsConstructor
public class CompanyPaymentAccountListQryExe {

	private final CompanyPaymentAccountGateway companyPaymentAccountGateway;
	private final CompanyPaymentAccountAssembler companyPaymentAccountAssembler;

	public List<CompanyPaymentAccountVO> execute(CompanyPaymentAccountListQry companyPaymentAccountListQry) {
		List<CompanyPaymentAccount> companyPaymentAccountList = companyPaymentAccountGateway.list(companyPaymentAccountListQry);
		return companyPaymentAccountList.stream().map(companyPaymentAccountAssembler::toCompanyPaymentAccountVO).toList();
	}
}

