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.DealerPageQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.DealerVO;
import com.xunhong.erp.turbo.biz.app.assembler.DealerAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.Dealer;
import com.xunhong.erp.turbo.biz.domain.gateway.DealerGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

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

	private final DealerGateway dealerGateway;
	private final DealerAssembler dealerAssembler;

	public IPage<DealerVO> execute(DealerPageQry dealerPageQry) {
		IPage<Dealer> page = dealerGateway.page(dealerPageQry);
		return page.convert(dealerAssembler::toDealerVO);
	}
}

