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

import com.xunhong.erp.turbo.api.biz.dto.qry.BoxProductListQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.BoxProductVO;
import com.xunhong.erp.turbo.biz.app.assembler.BoxProductAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.BoxProduct;
import com.xunhong.erp.turbo.biz.domain.gateway.BoxProductGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

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

	private final BoxProductGateway boxProductGateway;
	private final BoxProductAssembler boxProductAssembler;

	public List<BoxProductVO> execute(BoxProductListQry boxProductListQry) {
		List<BoxProduct> boxProductList = boxProductGateway.list(boxProductListQry);
		return boxProductList.stream().map(boxProductAssembler::toBoxProductVO).toList();
	}
}

