
package com.lideeyunji.core.framework.config.btncommand.receiver;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lideeyunji.core.framework.config.btncommand.param.ButtonParamReportList;
import com.lideeyunji.core.framework.service.IFrameService;
import com.lideeyunji.tool.framework.yunji.model.ResultDataModel;
import com.lideeyunji.tool.framework.yunji.tool.spring.SpringUtils;

import java.util.Map;

/**
 * 数据报表分页执行者
 */
public class ButtonReceiverReportList implements IButtonCommandReceiver<ResultDataModel> {


    private String pluginKey;

    private ButtonParamReportList param;

    public ButtonReceiverReportList(ButtonParamReportList param) {
        this.param = param;
    }

    /**
     * 执行命令
     * @return
     */
    @Override
    public ResultDataModel receiver() {

        String reportCode = param.getReportCode();
        Page page = param.getPage();
        Map<String, Object> params = param.getParams();

        IFrameService frameService = SpringUtils.getBean(IFrameService.class);
        ResultDataModel reportDataPage = frameService.getReportDataList(reportCode, page, params);
        return reportDataPage;
    }
}
