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

import com.xunhong.erp.turbo.api.biz.dto.qry.ShipOrderListQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.ShipOrderVO;
import com.xunhong.erp.turbo.biz.app.assembler.ShipOrderAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.ShipOrder;
import com.xunhong.erp.turbo.biz.domain.gateway.ShipOrderGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

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

	private final ShipOrderGateway shipOrderGateway;
	private final ShipOrderAssembler shipOrderAssembler;

	public List<ShipOrderVO> execute(ShipOrderListQry shipOrderListQry) {
		List<ShipOrder> shipOrderList = shipOrderGateway.list(shipOrderListQry);
		return shipOrderList.stream().map(shipOrderAssembler::toShipOrderVO).toList();
	}
}

