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.ChannelPageQry;
import com.xunhong.erp.turbo.api.infra.dto.vo.ChannelVO;
import com.xunhong.erp.turbo.infra.app.assembler.ChannelAssembler;
import com.xunhong.erp.turbo.infra.domain.entity.Channel;
import com.xunhong.erp.turbo.infra.domain.gateway.ChannelGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RequiredArgsConstructor
public class ChannelPageQryExe {
	private final ChannelGateway channelGateway;
	private final ChannelAssembler channelAssembler;

	public IPage<ChannelVO> execute(ChannelPageQry channelPageQry) {
		IPage<Channel> page = channelGateway.page(channelPageQry);
		return page.convert(channelAssembler::toChannelVO);
	}
}
