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.AuditPageQry;
import com.xunhong.erp.turbo.api.biz.dto.vo.AuditVO;
import com.xunhong.erp.turbo.biz.app.assembler.AuditAssembler;
import com.xunhong.erp.turbo.biz.domain.entity.Audit;
import com.xunhong.erp.turbo.biz.domain.gateway.AuditGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

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

    private final AuditGateway auditGateway;
    private final AuditAssembler auditAssembler;

    public IPage<AuditVO> execute(AuditPageQry auditPageQry) {
        IPage<Audit> page = auditGateway.page(auditPageQry);
        return page.convert(auditAssembler::toAuditVO);
    }
}

