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

import cn.hutool.json.JSONObject;
import com.jeelowcode.framework.utils.model.ExecuteEnhanceModel;
import com.jeelowcode.framework.utils.tool.spring.SpringUtils;
import com.jeelowcode.core.framework.config.btncommand.param.ButtonParamEditBatch;
import com.jeelowcode.core.framework.service.IFrameService;

import java.util.List;

/**
 * 编辑按钮执行者
 */
public class ButtonReceiverEditBatch implements IButtonCommandReceiver<ExecuteEnhanceModel> {


    private String pluginKey;

    private ButtonParamEditBatch param;

    public ButtonReceiverEditBatch(ButtonParamEditBatch param) {
        this.param = param;
    }

    /**
     * 执行命令
     * @return
     */
    @Override
    public ExecuteEnhanceModel receiver() {
        IFrameService frameService = SpringUtils.getBean(IFrameService.class);
        Long dbformId = param.getDbFormId();
        List<JSONObject> jsonObjectList = param.getJsonObjectList();
        frameService.editBatchData(dbformId, jsonObjectList);
        return null;
    }
}
