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

import com.xunhong.erp.turbo.api.biz.dto.qry.CostItemListQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.CostItemVO;
import com.xunhong.erp.turbo.biz.app.assembler.CostItemAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.CostItem;
import com.xunhong.erp.turbo.biz.domain.gateway.CostItemGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

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

	private final CostItemGateway costItemGateway;
	private final CostItemAssembler costItemAssembler;

	public List<CostItemVO> execute(CostItemListQry costItemListQry) {
		List<CostItem> costItemList = costItemGateway.list(costItemListQry);
		return costItemList.stream().map(costItemAssembler::toCostItemVO).toList();
	}
}

