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.DictionaryPageQry;
import com.xunhong.erp.turbo.api.infra.dto.vo.DictionaryVO;
import com.xunhong.erp.turbo.infra.app.assembler.DictionaryAssembler;
import com.xunhong.erp.turbo.infra.domain.entity.Dictionary;
import com.xunhong.erp.turbo.infra.domain.gateway.DictionaryGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

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

	private final DictionaryGateway dictionaryGateway;
	private final DictionaryAssembler dictionaryAssembler;

	public IPage<DictionaryVO> execute(DictionaryPageQry dictionaryPageQry) {
		IPage<Dictionary> page = dictionaryGateway.page(dictionaryPageQry);
		return page.convert(dictionaryAssembler::toDictionaryVO);
	}
}

