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

import com.xunhong.erp.turbo.api.biz.dto.qry.DealerPaymentAccountListQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.DealerPaymentAccountVO;
import com.xunhong.erp.turbo.biz.app.assembler.DealerPaymentAccountAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.DealerPaymentAccount;
import com.xunhong.erp.turbo.biz.domain.gateway.DealerPaymentAccountGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

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

	private final DealerPaymentAccountGateway dealerPaymentAccountGateway;
	private final DealerPaymentAccountAssembler dealerPaymentAccountAssembler;

	public List<DealerPaymentAccountVO> execute(DealerPaymentAccountListQry dealerPaymentAccountListQry) {
		List<DealerPaymentAccount> dealerPaymentAccountList = dealerPaymentAccountGateway.list(dealerPaymentAccountListQry);
		return dealerPaymentAccountList.stream().map(dealerPaymentAccountAssembler::toDealerPaymentAccountVO).toList();
	}
}

