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

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xunhong.erp.turbo.api.infra.dto.qry.PlatformPageQry;
import com.xunhong.erp.turbo.api.infra.dto.vo.PlatformVO;
import com.xunhong.erp.turbo.infra.app.assembler.PlatformAssembler;
import com.xunhong.erp.turbo.infra.domain.entity.Platform;
import com.xunhong.erp.turbo.infra.domain.gateway.PlatformGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

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

	private final PlatformGateway platformGateway;

	private final PlatformAssembler platformAssembler;

	public IPage<PlatformVO> execute(PlatformPageQry query) {
		IPage<Platform> page = platformGateway.page(query);
		return page.convert(platformAssembler::toPlatformVO);
	}
}
