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

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xunhong.erp.turbo.api.biz.dto.qry.GiftBoxPageQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.GiftBoxVO;
import com.xunhong.erp.turbo.biz.app.assembler.GiftBoxAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.GiftBox;
import com.xunhong.erp.turbo.biz.domain.gateway.GiftBoxGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

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

	private final GiftBoxGateway giftBoxGateway;
	private final GiftBoxAssembler giftBoxAssembler;

	public IPage<GiftBoxVO> execute(GiftBoxPageQry giftBoxPageQry) {
		IPage<GiftBox> page = giftBoxGateway.page(giftBoxPageQry);
		return page.convert(giftBoxAssembler::toGiftBoxVO);
	}
}

