优化:1、mtable、mlink、mservice、qtask 展示的排序最新展示到前面

2、其他修改
This commit is contained in:
2024-04-01 22:20:51 +08:00
parent 28813e1231
commit c5ea3cb944
12 changed files with 68 additions and 73 deletions

View File

@@ -89,7 +89,7 @@
<div class="form-group">
<label for="para" class="col-sm-2 required">数据平台</label>
<div class="col-md-6">
<select v-model="row.dbPlatId" class="form-control">
<select v-model="row.dbid" class="form-control">
<option></option>
<option v-for="item in dbPlats" :value="item.key" v-text="item.name"></option>
</select>

View File

@@ -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: {},

View File

@@ -70,7 +70,7 @@
<div class="col-xs-3">
<button @click="createService()" class="btn btn-primary" type="button"> 新建业务</button>
<button @click="createService({})" class="btn btn-primary" type="button"> 新建业务</button>
<hr>
<table class="table">
<tr>
@@ -82,8 +82,8 @@
<td>{{item.name}}</td>
<td>{{item.comment}}</td>
<td>
<a href="javascript:">编辑</a>
<a href="javascript:">删除</a>
<a @click="createService(item)" href="javascript:">编辑</a>
<!--<a href="javascript:">删除</a>-->
</td>
</tr>
@@ -174,7 +174,7 @@
<div class="base-info">字段信息</div>
<table class="table table-bordered">
<tr>
<td v-show="status==3 || status==4 || status==5 || status==6"><input type="checkbox"></td>
<td v-show="status==3 || status==4 || status==5 || status==6 || status=='detail' || status=='edit'"><input type="checkbox"></td>
<th v-show="status==1"></th>
<th>数据字段</th>
<th>注释</th>
@@ -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})`
}
},

View File

@@ -185,7 +185,7 @@
<label class="col-md-1 col-sm-1" style="padding-bottom: 10px;padding-top: 5px;">数据源选择</label>
<div class="col-md-2 col-sm-10" style="padding-bottom: 10px">
<select class="form-control" v-model="dbPlat">
<option v-for="item in dbPlats" :value="item" v-text="item.name"></option>
<option v-for="item in dbPlats" :value="item" v-text="item.dbname"></option>
</select>
</div>
<div class="col-md-2 col-sm-10" style="padding-bottom: 10px">
@@ -204,7 +204,7 @@
<!-- || tableData[item]['hv']==1 -->
<input type="checkbox"
v-model="ckTable"
:value="tableData[item]['name']"
:value="tableData[item]['tablename']"
:disabled="item=='表说明' || item=='表名称'"
>
<a :class="[{hv: tableData[item]['hv']==1 }]" href="javascript:;" @click="tableName=item" data-target="#tab3Content1" data-toggle="tab" v-text="item"></a>
@@ -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()
})

View File

@@ -7,7 +7,7 @@
<span class="input-group-btn">
<button class="btn btn-default" type="button">数据平台</button>
</span>
<select class="form-control" v-model="filter.dbPlatId" style="width: 150px;">
<select class="form-control" v-model="filter.dbid" style="width: 150px;">
<option></option>
<option v-for="item in dbPlats" :value="item.key">{{item.name}}</option>
</select>
@@ -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"]
}
}

View File

@@ -79,13 +79,15 @@
<table :class="['table','table-bordered']">
<tr>
<th style="width: 100px">表名</th>
<td><span class="label label-outline" title="表别名alias">{{row.alias}}</span> {{row.name}}</td>
<td><span class="label label-outline" title="表别名alias">{{row.alias}}</span> {{row.tablename}}</td>
<th>数据平台</th>
<td>{{dealDbPlatName(row)}}</td>
</tr>
<tr>
<th>描述</th>
<td>{{row.comment}}</td>
<td></td>
<td></td>
</tr>
</table>
@@ -169,7 +171,7 @@
<div class="form-group">
<label for="name" class="col-md-2">表名</label>
<div class="col-md-4 col-sm-8">
<input v-model="row.name" class="form-control" id="name" placeholder="请输入Table名称">
<input v-model="row.tablename" class="form-control" id="name" placeholder="请输入Table名称">
</div>
</div>
<div class="form-group">
@@ -184,7 +186,7 @@
<div class="col-sm-2">
<select v-model="row.dbid" class="form-control">
<option></option>
<option v-for="item in dbPlats" :value="item.key" v-text="item.name"></option>
<option v-for="item in dbPlats" :value="item.dbid" v-text="item.dbname"></option>
</select>
</div>
<div class="col-sm-2">
@@ -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

View File

@@ -1,4 +1,9 @@
<row class="plat">
<!-- head -->
<div class="col-md-12" style="margin-bottom: 5px">
<h3 v-text="cfg.title" class="pull-left"></h3>
<button @click="edit({})" class="btn btn-primary pull-right" type="button"> 新增数据平台 </button>
</div>
<div class="info">
<a @click="showInfo()" href="javascript:;"><i class="icon icon-info"></i></a>
@@ -30,18 +35,6 @@
</div>
</div>
<!-- head -->
<div class="col-md-11">
<h3 v-text="cfg.title"></h3>
</div>
<div class="col-md-1">
<div class="input-group pull-right" style="padding-top: 10px">
<span class="input-group-btn">
<button @click="edit({})" class="btn btn-primary" type="button"> 新增数据平台 </button>
</span>
</div>
</div>
<div class="col-md-12">
<table class="table table-bordered table-hover">
<thead>
@@ -149,7 +142,7 @@
el: ".plat",
data: {
cfg: {
title: "数据中心 管理",
title: "数据 管理",
cols: [
{col: "dbname", label: "数据平台名称"},
{col: "url", label: "数据平台连接地址"},

View File

@@ -1,15 +1,8 @@
<row class="plat">
<!-- head -->
<div class="col-md-11">
<h3 v-text="cfg.title"></h3>
</div>
<div class="col-md-1">
<div class="input-group pull-right" style="padding-top: 10px">
<span class="input-group-btn">
<button @click="edit({})" class="btn btn-primary" type="button"> 新增业务平台 </button>
</span>
</div>
<div class="col-md-12" style="margin-bottom: 5px">
<h3 v-text="cfg.title" class="pull-left"></h3>
<button @click="edit({})" class="btn btn-primary pull-right" type="button"> 新增业务平台 </button>
</div>
<div class="col-md-12">
@@ -82,7 +75,7 @@
el: ".plat",
data: {
cfg: {
title: "业务平台 管理",
title: "应用平台 管理",
cols: [
{col: "platname", label: "业务名称"},
{col: "plattoken", label: "Token"},

View File

@@ -25,7 +25,7 @@ public class Kv<K, V> extends LinkedHashMap<K, V> {
return new Kv();
}
public static Kv of(Object k, Object v) {
public static Kv<String, Object> of(Object k, Object v) {
return new Kv().set(k, v);
}
@@ -68,7 +68,7 @@ public class Kv<K, V> extends LinkedHashMap<K, V> {
}
// 将obj 属性映射到Kv 中
public static Kv toKv(Object m, String... fields) {
public static Kv<String, Object> toKv(Object m, String... fields) {
Kv kv = Kv.of();
if (m == null) {
return kv;

View File

@@ -24,10 +24,10 @@ public class ParseMysql implements Parser {
Predicate<Kv<String, MTable>> 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;
}
}

View File

@@ -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]")

View File

@@ -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;
@@ -33,11 +34,13 @@ public class MetadataService extends BaseService { //arango
.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())
).collect(Collectors.toList());
).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<MService> 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());