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

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

import java.util.Map;

/**
 * 数据报表分页执行者
 */
public class ButtonReceiverReportList extends ButtonReceiverBase 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;
    }
}
