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

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xunhong.erp.turbo.api.biz.dto.qry.BoxProductPageQry;
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;

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

	private final BoxProductGateway boxProductGateway;
	private final BoxProductAssembler boxProductAssembler;

	public IPage<BoxProductVO> execute(BoxProductPageQry boxProductPageQry) {
		IPage<BoxProduct> page = boxProductGateway.page(boxProductPageQry);
		return page.convert(boxProductAssembler::toBoxProductVO);
	}
}

