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

import com.xunhong.erp.turbo.api.biz.dto.qry.BoxSpecListQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.BoxSpecVO;
import com.xunhong.erp.turbo.biz.app.assembler.BoxSpecAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.BoxSpec;
import com.xunhong.erp.turbo.biz.domain.gateway.BoxSpecGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

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

    private final BoxSpecGateway boxSpecGateway;
    private final BoxSpecAssembler boxSpecAssembler;

    public List<BoxSpecVO> execute(BoxSpecListQry boxSpecListQry) {
        List<BoxSpec> boxSpecList = boxSpecGateway.list(boxSpecListQry);
        return boxSpecList.stream().map(boxSpecAssembler::toBoxSpecVO).toList();
    }
}

