|
|
@@ -34,31 +34,45 @@ public class DynPageLoadHandler extends AbstractDynPageHandler { |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (SwEnum.DatasetType.FORM.value.equals(dataSet.type)) {//单表 |
|
|
|
SwMap data; |
|
|
|
//懒加载,给个空对象 |
|
|
|
if (dataSet.lazy) { |
|
|
|
mapRet.put(dataSet.name, new SwMap()); |
|
|
|
continue; |
|
|
|
data = new SwMap(); |
|
|
|
} else { |
|
|
|
data = DynPageHelper.createBean(dataSet); |
|
|
|
} |
|
|
|
mapRet.put(dataSet.name, DynRetBean.createBean(DynPageHelper.createBean(dataSet))); |
|
|
|
afterAddBean(dataSet, data); |
|
|
|
mapRet.put(dataSet.name, DynRetBean.createBean(data)); |
|
|
|
} else if (SwEnum.DatasetType.TREE.value.equals(dataSet.type)) {//树 |
|
|
|
mapRet.put(dataSet.name, DynRetBean.createBean(new SwMap())); |
|
|
|
SwMap data = new SwMap(); |
|
|
|
afterAddBean(dataSet, data); |
|
|
|
mapRet.put(dataSet.name, DynRetBean.createBean(data)); |
|
|
|
} else if (!SwEnum.DatasetType.ENUM.value.equals(dataSet.type)) {//非枚举 |
|
|
|
mapRet.put(dataSet.name, DynRetBean.createList(SwListData.create(null, 0))); |
|
|
|
SwListData listData = SwListData.create(null, 0); |
|
|
|
afterAddList(dataSet, listData); |
|
|
|
mapRet.put(dataSet.name, DynRetBean.createList(listData)); |
|
|
|
} |
|
|
|
} |
|
|
|
return R.success(mapRet); |
|
|
|
} |
|
|
|
|
|
|
|
//新增初始化 - bean |
|
|
|
protected void afterAddBean(PageDataset dataset, SwMap bean){} |
|
|
|
//新增初始化 - list |
|
|
|
protected void afterAddList(PageDataset dataset, SwListData bean){} |
|
|
|
|
|
|
|
//新增操作,初始化定义的数据集 |
|
|
|
public R addOne() { |
|
|
|
//对应的数据集定义 |
|
|
|
PageDataset pageDataSet = readParamDs(); |
|
|
|
PageDataset dataset = readParamDs(); |
|
|
|
|
|
|
|
if (!pageDataSet.canEdit) { |
|
|
|
return R.error("指定数据集为只读数据集[" + pageDataSet.label + "]!"); |
|
|
|
if (!dataset.canEdit) { |
|
|
|
return R.error("指定数据集为只读数据集[" + dataset.label + "]!"); |
|
|
|
} |
|
|
|
//懒加载,给个空对象 |
|
|
|
return R.success(DynRetBean.createBean(DynPageHelper.createBean(pageDataSet))); |
|
|
|
SwMap data = DynPageHelper.createBean(dataset); |
|
|
|
afterAddBean(dataset, data); |
|
|
|
return R.success(DynRetBean.createBean(data)); |
|
|
|
} |
|
|
|
|
|
|
|
public R loadOne() { |
|
|
|