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.OrderCostPageQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.OrderCostVO;
import com.xunhong.erp.turbo.biz.app.assembler.OrderCostAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.OrderCost;
import com.xunhong.erp.turbo.biz.domain.gateway.OrderCostGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

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

    private final OrderCostGateway orderCostGateway;
    private final OrderCostAssembler orderCostAssembler;

    public IPage<OrderCostVO> execute(OrderCostPageQry orderCostPageQry) {
        IPage<OrderCost> page = orderCostGateway.page(orderCostPageQry);
        return page.convert(orderCostAssembler::toOrderCostVO);
    }
}

