Преглед на файлове

模块子页面保存bug

master
FLYPHT преди 2 години
родител
ревизия
afe38d148b
променени са 1 файла, в които са добавени 17 реда и са изтрити 9 реда
  1. +17
    -9
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormSaveHandler.java

+ 17
- 9
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<ModelForm> {
listFormChild = new ArrayList<>();
Set<ModelForm> 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<ModelForm> {
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<ModelForm> {
@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<ModelForm> {
@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<ModelForm> {

//已经存在的,不管了
private boolean existsPage(Set<ModelForm> setExists, String name) {
if (setExists == null){
return false;
}
for (ModelForm form : setExists) {
if (name.equalsIgnoreCase(form.getName())) return true;
}


Зареждане…
Отказ
Запис