|
@@ -52,7 +52,7 @@ public class LCSingleSaveHandler extends AbstractDynPageHandler { |
|
|
//对应的数据集定义 |
|
|
//对应的数据集定义 |
|
|
PageDataset pageDataSet = LCSingleHelper.findCardDataset(datasets); |
|
|
PageDataset pageDataSet = LCSingleHelper.findCardDataset(datasets); |
|
|
//读取待保存的bean |
|
|
//读取待保存的bean |
|
|
DefaultEntity bean = readBeanFromPage(pageDataSet, data.readMap("form")); |
|
|
|
|
|
|
|
|
DefaultEntity bean = readBeanFromPage(pageDataSet, data); |
|
|
if (filter != null && bean.isNew()) {//有过滤条件,将关联的值设上 |
|
|
if (filter != null && bean.isNew()) {//有过滤条件,将关联的值设上 |
|
|
setLinkValue(pageDataSet, bean, f -> filter.get(f.name)); |
|
|
setLinkValue(pageDataSet, bean, f -> filter.get(f.name)); |
|
|
} |
|
|
} |
|
@@ -74,7 +74,7 @@ public class LCSingleSaveHandler extends AbstractDynPageHandler { |
|
|
afterRollback(bean); |
|
|
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 |
|
|
* @param data |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
protected DefaultEntity readBeanFromPage(PageDataset pageDataSet, SwMap data) { |
|
|
|
|
|
|
|
|
protected DefaultEntity readBeanFromPage(PageDataset pageDataSet, SwMap pageData) { |
|
|
ModelTable table = ModelTableCache.getInstance().get(pageDataSet.masterTable); |
|
|
ModelTable table = ModelTableCache.getInstance().get(pageDataSet.masterTable); |
|
|
if (table == null) throw new BizException("没有找到待保存的表定义:" + pageDataSet.name); |
|
|
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()); |
|
|
long id = data.readLong(table.getIdField()); |
|
|
|
|
|
|
|
|
EntityDao<DefaultEntity> dao = DbEngine.getInstance().findDao(table.getName()); |
|
|
EntityDao<DefaultEntity> dao = DbEngine.getInstance().findDao(table.getName()); |
|
|