ソースを参照

页面设计

master
郑根木 2年前
コミット
e78fc52df8
3個のファイルの変更45行の追加3行の削除
  1. +1
    -0
      smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/jdbc/JdbcEngine.java
  2. +43
    -2
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/table/ModelCatalogTreeHandler.java
  3. +1
    -1
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageHelper.java

+ 1
- 0
smtweb-framework/sw-framework-core/src/main/java/cc/smtweb/framework/core/db/jdbc/JdbcEngine.java ファイルの表示

@@ -437,6 +437,7 @@ public class JdbcEngine {
List<T> list = queryN(sql, params, type);

if (list != null && !list.isEmpty()) {
if (list.size() > 1) throw new SwException("您调用的查询单个对象的方法,结果却查出了多条!");
return list.get(0);
}



+ 43
- 2
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/table/ModelCatalogTreeHandler.java ファイルの表示

@@ -32,6 +32,7 @@ public class ModelCatalogTreeHandler extends AbstractTreeHandler<DefaultEntity>

private long prj_id;//所属项目
private int type;//查询类型:0-目录;1-表定义;2-页面定义
private boolean exc_empty;//排除空目录,type非目录时有效

private ModelCatalogTreeHelper mcTreeHelper = null;

@@ -40,6 +41,7 @@ public class ModelCatalogTreeHandler extends AbstractTreeHandler<DefaultEntity>
super.init(params, us);
type = params.readInt("type");
prj_id = params.readLong("prj_id");
exc_empty = params.readBool("exc_empty");
mcTreeHelper = (ModelCatalogTreeHelper) TreeHelper.getTreeHelper(ModelCatalog.ENTITY_NAME, ModelCatalogTreeHelper.class);
}

@@ -84,8 +86,12 @@ public class ModelCatalogTreeHandler extends AbstractTreeHandler<DefaultEntity>
@Override
protected List<DefaultEntity> getChildren(long id) {
List<ModelCatalog> list = mcTreeHelper.getChildren(id, prj_id, (o1, o2) -> CommUtil.chineseCompare(o1.getName(), o2.getName()));

List<DefaultEntity> listRet = new ArrayList<>(list);
List<DefaultEntity> listRet;
if (type != TYPE_CATALOG && exc_empty) {//排除空目录
listRet = cleanEmpty(list);
} else {
listRet = new ArrayList<>(list);
}

switch (type) {
case TYPE_TABLE:
@@ -99,6 +105,41 @@ public class ModelCatalogTreeHandler extends AbstractTreeHandler<DefaultEntity>
return listRet;
}

/**
* 去掉没有叶子的空目录
* @param list
* @return
*/
private List<DefaultEntity> cleanEmpty(List<ModelCatalog> list) {
if (list.isEmpty()) return new ArrayList<>(list);
List<DefaultEntity> lret = new ArrayList<>();
for (ModelCatalog mc: list) {
if (hasChildren(mc)) lret.add(mc);
}
return lret;
}

//递归判断,目录是否有儿子
private boolean hasChildren(ModelCatalog mc) {
List<DefaultEntity> listRet = new ArrayList<>();
switch (type) {
case TYPE_TABLE:
addTableChildren(listRet, mc.getId());
break;
case TYPE_PAGE:
case TYPE_WIDGET:
case TYPE_FORM:
addPageChildren(listRet, mc.getId(), type);
}
if (!listRet.isEmpty()) return true;
List<ModelCatalog> list = mcTreeHelper.getChildren(mc.getId(), prj_id, null);
if (list == null || list.isEmpty()) return false;
for (ModelCatalog c: list) {
if (hasChildren(c)) return true;
}
return false;
}

//增加表
private void addTableChildren(List<DefaultEntity> listRet, long mcid) {
Collection<ModelTable> set = ModelTableCache.getInstance().getTablesByMc(mcid, (o1, o2) -> CommUtil.chineseCompare(o1.getName(), o2.getName()));


+ 1
- 1
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageHelper.java ファイルの表示

@@ -35,7 +35,7 @@ public class DynPageHelper {
public static SwMap createBean(PageDataset dataSet) {
//主表
ModelTable masterTable = ModelTableCache.getInstance().get(dataSet.masterTable);
EntityDao<DefaultEntity> dao = DbEngine.getInstance().findDao(masterTable.getTableName());
EntityDao<DefaultEntity> dao = DbEngine.getInstance().findDao(masterTable.getName());
try {
DefaultEntity bean = dao.createBean();
return bean.getData();


読み込み中…
キャンセル
保存