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

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xunhong.erp.turbo.api.rbac.dto.qry.RolePageQry;
import com.xunhong.erp.turbo.api.rbac.dto.vo.RoleVO;
import com.xunhong.erp.turbo.rbac.app.assembler.RoleAssembler;
import com.xunhong.erp.turbo.rbac.domain.entity.Role;
import com.xunhong.erp.turbo.rbac.domain.gateway.RoleGateway;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
public class RolePageQryExe {

	private final RoleGateway roleGateway;
	private final RoleAssembler roleAssembler;

	public IPage<RoleVO> execute(RolePageQry rolePageQry) {
		IPage<Role> page = roleGateway.page(rolePageQry);
		return page.convert(roleAssembler::toRoleVO);
	}
}
