diff --git a/root/content/funs.html b/root/content/funs.html index e50da78..09716e1 100644 --- a/root/content/funs.html +++ b/root/content/funs.html @@ -89,7 +89,7 @@
- diff --git a/root/index.html b/root/index.html index c34a344..a3e9f60 100644 --- a/root/index.html +++ b/root/index.html @@ -137,13 +137,13 @@ { name: "QTask", url: "/qtask", nodes: [ {url:"/qtask/list.html", name:"QTask", icon:"icon-cube-alt"}, - {url:"/qtask/debug.html", name:"QTask-Debug", icon:"icon-bug"}, + /*{url:"/qtask/debug.html", name:"QTask-Debug", icon:"icon-bug"},*/ ] }, { name: "平台管理", url: "/plat/db.html", nodes: [ - {url:"/plat/db.html", name:"数据中心", icon: "icon-database"}, - {url:"/plat/index.html", name:"业务平台", icon:"icon-server"}, + {url:"/plat/db.html", name:"数据源", icon: "icon-database"}, + {url:"/plat/index.html", name:"应用平台", icon:"icon-server"}, ] }, {name: "关于", url: "/single", nodes: [ @@ -153,7 +153,7 @@ {url:"/single/metaFlow.html", name:"MetaKit使用", icon:"icon-server"}, ] }, - { + /*{ name: "其他服务", url: "/plat/db.html", nodes: [ {url:"/oth/index.html", name:"业务平台管理", icon: "icon-database"}, {url:"/oth/file.html", name:"文件服务", icon: "icon-database"}, @@ -174,7 +174,7 @@ {url:"/weixin/templateMessage.html", name:"模板消息", icon:"icon-server"}, {url:"/weixin/timer.html", name:"Timer", icon:"icon-server"}, ] - } + }*/ ], menus: {}, page: {}, diff --git a/root/metadata/metaService.html b/root/metadata/metaService.html index bd3d46e..8697c73 100644 --- a/root/metadata/metaService.html +++ b/root/metadata/metaService.html @@ -70,7 +70,7 @@
- +
@@ -82,8 +82,8 @@ @@ -174,7 +174,7 @@
字段信息
{{item.name}} {{item.comment}} - 编辑 - 删除 + 编辑 +
- + @@ -1105,8 +1105,8 @@ red.showMsg(); } }, - createService() { - this.createRow = {} + createService(row) { + this.createRow = row if (this.tables.length == 0) { tableLinkList().then(res => { this.tables = res @@ -1116,7 +1116,7 @@ }, saveService() { serviceSave({service: this.createRow}).then(res => { - red.showOk("创建成功, 请对业务进行配置") + red.showOk(this.createRow['servid'] ? "操作成功" : "创建成功, 请对业务进行配置") $('#createServiceDia').modal('hide') this.service = this.createRow.name @@ -1133,7 +1133,7 @@ }, dealTableName(item) { let table = this.serviceDetail['tables'][item] - return `[${table.alias}] ${table.name} (${table.comment})` + return `[${table.alias}] ${table.tablename} (${table.comment})` } }, diff --git a/root/metadata/metatable/import.html b/root/metadata/metatable/import.html index b81bac7..8ff7c2c 100644 --- a/root/metadata/metatable/import.html +++ b/root/metadata/metatable/import.html @@ -185,7 +185,7 @@
@@ -204,7 +204,7 @@ @@ -292,7 +292,7 @@ tableData: {}, tableArr: [], dbPlat: red.getData("dbPlat",{}), - dbid: red.getData("dbPlatId",''), + dbid: red.getData("dbid",''), catalog: '', tableName: '', ckTable: [], @@ -324,7 +324,7 @@ } }, dbPlat(v) { - this.dbPlatId = v['key'] + this.dbid = v['dbid'] this.catalogs = v['catalogs'] }, catalog() { @@ -332,7 +332,7 @@ //cache red.setData("dbPlat", this.dbPlat) - red.setData("dbPlatId", this.dbPlatId) + red.setData("dbid", this.dbid) red.setData("catalog", this.catalog) }, tableName() { @@ -391,8 +391,8 @@ }, //------从mysql导入使用的相关方法------- loadTables() { // 查询table列表 - let [dbPlatId, catalog] = [this.dbPlatId, this.catalog] - sheetMySql({dbPlatId, catalog}).then(res => { // 数据转换 + let [dbid, catalog] = [this.dbid, this.catalog] + sheetMySql({dbid, catalog}).then(res => { // 数据转换 this.tableData = res let tableArr = [] let ckTable = [] @@ -413,7 +413,7 @@ this.tableInfo = this.tableData[this.tableName] if (!this.tableInfo['load']) { - tableInfo({dbPlatId: this.dbPlatId, catalog: this.catalog, tableName: this.tableName}).then(res => { + tableInfo({dbid: this.dbid, catalog: this.catalog, tableName: this.tableName}).then(res => { res['hv'] = this.tableData[this.tableName]['hv'] res['load'] = 1 @@ -424,8 +424,8 @@ }, saveTable() { // 保存数据 if (this.cate == 'mysql') { - let [dbPlatId, catalog, tableArr] = [this.dbPlatId, this.catalog, this.ckTable] - saveTable({dbPlatId, catalog, tableArr}).then(res => { + let [dbid, catalog, tableArr] = [this.dbid, this.catalog, this.ckTable] + saveTable({dbid, catalog, tableArr}).then(res => { red.showOk() this.loadTables() }) diff --git a/root/metadata/metatable/list.html b/root/metadata/metatable/list.html index 61c64a6..2f613e8 100644 --- a/root/metadata/metatable/list.html +++ b/root/metadata/metatable/list.html @@ -7,7 +7,7 @@ - @@ -65,7 +65,7 @@ }, dbPlats:[], list:{rows:[{name:"user", comment:"[用户表]", dataCount: 23}]}, - filter: {dbPlatId: "", catalog: "", name: ""}, + filter: {dbid: "", catalog: "", name: ""}, }, watch: { filter: { @@ -81,7 +81,7 @@ catalogs: function () { var dbPlats = this.dbPlats; for (i in dbPlats) { - if (dbPlats[i].key == this.filter.dbPlatId) { + if (dbPlats[i].key == this.filter.dbid) { return dbPlats[i]["catalogs"] } } diff --git a/root/metadata/metatable/metaTable.html b/root/metadata/metatable/metaTable.html index fa74f23..c1ed11c 100644 --- a/root/metadata/metatable/metaTable.html +++ b/root/metadata/metatable/metaTable.html @@ -79,13 +79,15 @@
数据字段 注释
- + + +
表名{{row.alias}} {{row.name}}{{row.alias}} {{row.tablename}} 数据平台 {{dealDbPlatName(row)}}
描述 {{row.comment}}
@@ -169,7 +171,7 @@
- +
@@ -184,7 +186,7 @@
@@ -514,8 +516,8 @@ dealDbPlatName(row) { let name = "" this.dbPlats.forEach(function (item) { - if (item.key == row.dbPlatId) { - name = item.name + if (item.dbid === row.dbid) { + name = item.dbname } }) name += "." + row.catalog diff --git a/root/plat/db.html b/root/plat/db.html index f60b1da..62c3a96 100644 --- a/root/plat/db.html +++ b/root/plat/db.html @@ -1,4 +1,9 @@ + +
+

+ +
@@ -30,18 +35,6 @@
- -
-

-
-
-
- - - -
-
-
@@ -149,7 +142,7 @@ el: ".plat", data: { cfg: { - title: "数据中心 管理", + title: "数据源 管理", cols: [ {col: "dbname", label: "数据平台名称"}, {col: "url", label: "数据平台连接地址"}, diff --git a/root/plat/index.html b/root/plat/index.html index 2e01b45..a80d593 100644 --- a/root/plat/index.html +++ b/root/plat/index.html @@ -1,15 +1,8 @@ - -
-

-
-
-
- - - -
+
+

+
@@ -82,7 +75,7 @@ el: ".plat", data: { cfg: { - title: "业务平台 管理", + title: "应用平台 管理", cols: [ {col: "platname", label: "业务名称"}, {col: "plattoken", label: "Token"}, diff --git a/src/main/java/net/tccn/base/Kv.java b/src/main/java/net/tccn/base/Kv.java index be08148..c5457d2 100644 --- a/src/main/java/net/tccn/base/Kv.java +++ b/src/main/java/net/tccn/base/Kv.java @@ -25,7 +25,7 @@ public class Kv extends LinkedHashMap { return new Kv(); } - public static Kv of(Object k, Object v) { + public static Kv of(Object k, Object v) { return new Kv().set(k, v); } @@ -68,7 +68,7 @@ public class Kv extends LinkedHashMap { } // 将obj 属性映射到Kv 中 - public static Kv toKv(Object m, String... fields) { + public static Kv toKv(Object m, String... fields) { Kv kv = Kv.of(); if (m == null) { return kv; diff --git a/src/main/java/net/tccn/base/dbq/parser/ParseMysql.java b/src/main/java/net/tccn/base/dbq/parser/ParseMysql.java index 7ea6cc3..67ade18 100644 --- a/src/main/java/net/tccn/base/dbq/parser/ParseMysql.java +++ b/src/main/java/net/tccn/base/dbq/parser/ParseMysql.java @@ -24,10 +24,10 @@ public class ParseMysql implements Parser { Predicate> sameDbFun = (kv) -> { int dbid = 0; - for (MTable metaTable : kv.values()) { + for (MTable mTable : kv.values()) { if (dbid == 0) { - dbid = metaTable.getDbid(); - } else if (dbid != metaTable.getDbid()) { + dbid = mTable.getDbid(); + } else if (dbid != mTable.getDbid()) { return false; } } diff --git a/src/main/java/net/tccn/meta/MTable.java b/src/main/java/net/tccn/meta/MTable.java index e95e0c6..e062ed6 100644 --- a/src/main/java/net/tccn/meta/MTable.java +++ b/src/main/java/net/tccn/meta/MTable.java @@ -19,7 +19,7 @@ import java.util.stream.Collectors; @Setter @Entity @Table(name = "mtable", comment = "TABLE记录表") -@Cacheable(value = true, interval = 60 * 60 * 1000, direct = true) +//@Cacheable(value = true, interval = 60 * 60 * 1000, direct = true) public class MTable extends BaseEntity { @Id @Column(comment = "[表ID]") diff --git a/src/main/java/net/tccn/meta/MetadataService.java b/src/main/java/net/tccn/meta/MetadataService.java index 2db8851..2b8e375 100644 --- a/src/main/java/net/tccn/meta/MetadataService.java +++ b/src/main/java/net/tccn/meta/MetadataService.java @@ -7,6 +7,7 @@ import org.redkale.net.http.RestMapping; import org.redkale.net.http.RestParam; import org.redkale.net.http.RestService; +import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -28,16 +29,18 @@ public class MetadataService extends BaseService { //arango (isEmpty(name) || x.getTablename().contains(name)) && (isEmpty(token) || x.getPlatid().equals(platId(token))) && (isEmpty(x.getStatus()) || x.getStatus() != 9) - ).map(x -> Kv.of("tablename", x.getTablename()) - .set("comment", x.getComment()) - .set("catalog", x.getCatalog()) - .set("alias", x.getAlias()) - .set("dbid", x.getDbid()) - .set("linkCount", MetaKit.getMetaLinks().stream().filter(link -> { // 关联表数量 - String[] tables = link.getTables(); - return x.getAlias().equals(tables[0]) || x.getAlias().equals(tables[1]); - }).count()) - ).collect(Collectors.toList()); + ).map(x -> Kv.of("tablename", x.getTablename()) + .set("comment", x.getComment()) + .set("catalog", x.getCatalog()) + .set("alias", x.getAlias()) + .set("dbid", x.getDbid()) + .set("tableid", x.getTableid()) + .set("linkCount", MetaKit.getMetaLinks().stream().filter(link -> { // 关联表数量 + String[] tables = link.getTables(); + return x.getAlias().equals(tables[0]) || x.getAlias().equals(tables[1]); + }).count()) + ).sorted(Comparator.comparing(x -> -x.getInt("tableid"))) + .collect(Collectors.toList()); return jBean.setBody(list); } @@ -48,6 +51,7 @@ public class MetadataService extends BaseService { //arango List list = MetaKit.getMetaServices().stream() .filter(x -> platId(token).equals(x.getPlatid())) + .sorted(Comparator.comparing(MService::getServid).reversed()) .collect(Collectors.toList()); jBean.setBody(list); @@ -234,6 +238,7 @@ public class MetadataService extends BaseService { //arango Kv kv = Kv.of("tablename", x.getTablename()) .set("comment", x.getComment()) .set("alias", x.getAlias()) + .set("tableid", x.getTableid()) .set("linkCount", 0); //关联表数量 @@ -244,7 +249,8 @@ public class MetadataService extends BaseService { //arango kv.set("linkCount", count); return kv; - }).collect(Collectors.toList()); + }).sorted(Comparator.comparingInt(x -> -x.getInt("tableid"))) + .collect(Collectors.toList()); return jBean.setBody(list); } @@ -263,6 +269,7 @@ public class MetadataService extends BaseService { //arango .set("comment", linkTable.getComment()) .set("linkSize", x.getLinks().size()) .set("links", x.getLinks()); + return kv; }).collect(Collectors.toList());