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.SupplierPageQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.SupplierVO;
import com.xunhong.erp.turbo.biz.app.assembler.SupplierAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.Supplier;
import com.xunhong.erp.turbo.biz.domain.gateway.SupplierGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

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

	private final SupplierGateway supplierGateway;
	private final SupplierAssembler supplierAssembler;

	public IPage<SupplierVO> execute(SupplierPageQry supplierPageQry) {
		IPage<Supplier> page = supplierGateway.page(supplierPageQry);
		return page.convert(supplierAssembler::toSupplierVO);
	}
}

