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


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xunhong.erp.turbo.api.user.dto.qry.UserPageQry;
import com.xunhong.erp.turbo.api.user.dto.vo.UserVO;
import com.xunhong.erp.turbo.user.app.assembler.UserAssembler;
import com.xunhong.erp.turbo.user.domain.entity.User;
import com.xunhong.erp.turbo.user.domain.gateway.UserGateway;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
public class UserPageQryExe {
	private final UserGateway userGateway;

	private final UserAssembler userAssembler;

	public IPage<UserVO> execute(UserPageQry userPageQry) {
		IPage<User> page = userGateway.page(userPageQry);
		return page.convert(userAssembler::toUserVO);
	}
}
