package cc.smtweb.system.bpm.web.design.flow;

import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.framework.core.mvc.service.DefaultLoadHandler;

/**
 * Created by Akmm at 2022/5/9 16:17
 */
public class ModelProcLoadHandler extends DefaultLoadHandler<ModelProc> {
    public ModelProcLoadHandler() {
        super(ModelProc.ENTITY_NAME);
    }

    @Override
    protected void afterLoad(ModelProc bean) {
        bean.getData().remove("prc_content");
    }


    //页面设计 - 加载页面model定义
    public R loadModel() {
        long id = params.readLong("id");
        ModelProc bean = ModelProcCache.getInstance().get(id);
        if (bean == null) throw new BizException("没有找到指定定义信息！id=" + id);
        return R.success(bean.getContent());
    }
}
