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

import com.lideeyunji.core.framework.config.btncommand.param.ButtonParamDel;
import com.lideeyunji.tool.framework.yunji.model.ExecuteEnhanceModel;
import com.lideeyunji.tool.framework.yunji.tool.spring.SpringUtils;
import com.lideeyunji.core.framework.service.IFrameService;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 删除按钮执行者
 */
public class ButtonReceiverDel implements IButtonCommandReceiver<ExecuteEnhanceModel> {


    private String pluginKey;

    private ButtonParamDel param;

    public ButtonReceiverDel(ButtonParamDel param) {
        this.param = param;
    }

    /**
     * 执行命令
     * @return
     */
    @Override
    public ExecuteEnhanceModel receiver() {
        IFrameService frameService = SpringUtils.getBean(IFrameService.class);
        Long dbformId = param.getDbFormId();
        List<Long> dataIdList = param.getDataIdList();

        Map<String,Object> params=new HashMap<>();
        params.put("dataIdList",dataIdList);
        params.put("whereFieldCode","id");

        //逻辑删除
        ExecuteEnhanceModel enhanceModel = frameService.delData(dbformId, params);
        return enhanceModel;
    }
}
