From afe38d148b8a786431c7081376a608f66e467703 Mon Sep 17 00:00:00 2001 From: FLYPHT <1035748121@qq.com> Date: Wed, 20 Jul 2022 22:54:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E5=9D=97=E5=AD=90=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=BF=9D=E5=AD=98bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bpm/web/design/form/ModelFormSaveHandler.java | 26 ++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormSaveHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormSaveHandler.java index eb025a5..7976845 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormSaveHandler.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormSaveHandler.java @@ -2,8 +2,6 @@ package cc.smtweb.system.bpm.web.design.form; import cc.smtweb.framework.core.common.R; import cc.smtweb.framework.core.common.SwEnum; -import cc.smtweb.framework.core.exception.BizException; -import cc.smtweb.framework.core.exception.SwException; import cc.smtweb.framework.core.common.SwMap; import cc.smtweb.framework.core.db.DbEngine; import cc.smtweb.framework.core.db.EntityDao; @@ -11,6 +9,7 @@ import cc.smtweb.framework.core.db.cache.ModelTableCache; import cc.smtweb.framework.core.db.jdbc.AbsDbWorker; import cc.smtweb.framework.core.db.vo.ModelField; import cc.smtweb.framework.core.db.vo.ModelTable; +import cc.smtweb.framework.core.exception.BizException; import cc.smtweb.framework.core.mvc.service.DefaultSaveHandler; import cc.smtweb.framework.core.util.CommUtil; import cc.smtweb.framework.core.util.JsonUtil; @@ -60,11 +59,13 @@ public class ModelFormSaveHandler extends DefaultSaveHandler { listFormChild = new ArrayList<>(); Set setExists = ModelFormCache.getInstance().getListByModule(bean.getEntityId()); //维护已有的子页面 - for (ModelForm mf: setExists) { - if (!CommUtil.isStrEquals(mf.getService(), bean.getService())) { - mf.setService(bean.getService()); - dao.updateEntityEx(bean, "mf_content", "mf_dataset", "mf_tmpl"); - listFormChild.add(mf); + if(setExists!=null){ + for (ModelForm mf: setExists) { + if (!CommUtil.isStrEquals(mf.getService(), bean.getService())) { + mf.setService(bean.getService()); + dao.updateEntityEx(bean, "mf_content", "mf_dataset", "mf_tmpl"); + listFormChild.add(mf); + } } } if (opts == null) return; @@ -79,7 +80,11 @@ public class ModelFormSaveHandler extends DefaultSaveHandler { page.getData().putAll(bean.getData()); page.setId(DbEngine.getInstance().nextId()); page.setOption("{}"); + page.setDataset(null); + page.setTmpl(null); + page.setType(SwEnum.FormType.PAGE.value); page.setName(name); + page.setParent(bean.getId()); page.setTitle(bean.getTitle() + "_" + SwEnum.PageType.instance.getName(type)); listFormChild.add(page); dao.insertEntity(page); @@ -89,7 +94,7 @@ public class ModelFormSaveHandler extends DefaultSaveHandler { @Override protected void saveSuccess() { ModelFormCache.getInstance().put(bean); - if (listFormChild == null) { + if (listFormChild != null) { for (ModelForm page : listFormChild) { ModelFormCache.getInstance().put(page); } @@ -99,7 +104,7 @@ public class ModelFormSaveHandler extends DefaultSaveHandler { @Override protected void saveFailed() { ModelFormCache.getInstance().reset(bean); - if (listFormChild == null) { + if (listFormChild != null) { for (ModelForm page : listFormChild) { ModelFormCache.getInstance().reset(page); } @@ -108,6 +113,9 @@ public class ModelFormSaveHandler extends DefaultSaveHandler { //已经存在的,不管了 private boolean existsPage(Set setExists, String name) { + if (setExists == null){ + return false; + } for (ModelForm form : setExists) { if (name.equalsIgnoreCase(form.getName())) return true; }