diff --git a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleSaveHandler.java b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleSaveHandler.java index 5d8063f..b06620d 100644 --- a/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleSaveHandler.java +++ b/smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/listcard/single/LCSingleSaveHandler.java @@ -52,7 +52,7 @@ public class LCSingleSaveHandler extends AbstractDynPageHandler { //对应的数据集定义 PageDataset pageDataSet = LCSingleHelper.findCardDataset(datasets); //读取待保存的bean - DefaultEntity bean = readBeanFromPage(pageDataSet, data.readMap("form")); + DefaultEntity bean = readBeanFromPage(pageDataSet, data); if (filter != null && bean.isNew()) {//有过滤条件,将关联的值设上 setLinkValue(pageDataSet, bean, f -> filter.get(f.name)); } @@ -74,7 +74,7 @@ public class LCSingleSaveHandler extends AbstractDynPageHandler { afterRollback(bean); } }); - return R.success(DynRetBean.createBean(bean.getData())); + return R.success(LCSingleHelper.buildRetData(pageDataSet.name, bean.getData())); } /** @@ -84,9 +84,15 @@ public class LCSingleSaveHandler extends AbstractDynPageHandler { * @param data * @return */ - protected DefaultEntity readBeanFromPage(PageDataset pageDataSet, SwMap data) { + protected DefaultEntity readBeanFromPage(PageDataset pageDataSet, SwMap pageData) { ModelTable table = ModelTableCache.getInstance().get(pageDataSet.masterTable); if (table == null) throw new BizException("没有找到待保存的表定义:" + pageDataSet.name); + + SwMap data = pageData.readMap(pageDataSet.name); + if (data == null) throw new BizException("没有找到待保存的表数据:" + pageDataSet.name); + data = data.readMap("form"); + if (data == null) throw new BizException("没有找到待保存的表数据:" + pageDataSet.name); + long id = data.readLong(table.getIdField()); EntityDao dao = DbEngine.getInstance().findDao(table.getName());