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

import com.xunhong.erp.turbo.api.biz.dto.qry.DealerWarehouseListQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.DealerWarehouseVO;
import com.xunhong.erp.turbo.biz.app.assembler.DealerWarehouseAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.DealerWarehouse;
import com.xunhong.erp.turbo.biz.domain.gateway.DealerWarehouseGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

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

	private final DealerWarehouseGateway dealerWarehouseGateway;
	private final DealerWarehouseAssembler dealerWarehouseAssembler;

	public List<DealerWarehouseVO> execute(DealerWarehouseListQry dealerWarehouseListQry) {
		List<DealerWarehouse> dealerWarehouseList = dealerWarehouseGateway.list(dealerWarehouseListQry);
		return dealerWarehouseList.stream().map(dealerWarehouseAssembler::toDealerWarehouseVO).toList();
	}
}

