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.OrderSupplierPageQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.OrderSupplierVO;
import com.xunhong.erp.turbo.biz.app.assembler.OrderSupplierAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.OrderSupplier;
import com.xunhong.erp.turbo.biz.domain.gateway.OrderSupplierGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

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

    private final OrderSupplierGateway orderSupplierGateway;
    private final OrderSupplierAssembler orderSupplierAssembler;

    public IPage<OrderSupplierVO> execute(OrderSupplierPageQry orderSupplierPageQry) {
        IPage<OrderSupplier> page = orderSupplierGateway.page(orderSupplierPageQry);
        return page.convert(orderSupplierAssembler::toOrderSupplierVO);
    }
}

