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

import cn.hutool.json.JSONObject;
import com.lideeyunji.tool.framework.yunji.model.ExecuteEnhanceModel;
import com.lideeyunji.tool.framework.yunji.tool.spring.SpringUtils;
import com.lideeyunji.core.framework.config.btncommand.param.ButtonParamEditBatch;
import com.lideeyunji.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;
    }
}
