1、引入lombok支持,重构JavaBean 将 常规getter/setter去除
2、去除Gson 依赖
This commit is contained in:
9
pom.xml
9
pom.xml
@@ -48,10 +48,17 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.6</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--<dependency>
|
||||||
<groupId>com.google.code.gson</groupId>
|
<groupId>com.google.code.gson</groupId>
|
||||||
<artifactId>gson</artifactId>
|
<artifactId>gson</artifactId>
|
||||||
<version>2.8.4</version>
|
<version>2.8.4</version>
|
||||||
</dependency>
|
</dependency>-->
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
getTableList(callback) {
|
/*getTableList(callback) {
|
||||||
red.getJSON("/meta/tablelist",{}, json => callback(json));
|
red.getJSON("/meta/tablelist",{}, json => callback(json));
|
||||||
},
|
},*/
|
||||||
/*getTableDetail({name}, callback) {
|
/*getTableDetail({name}, callback) {
|
||||||
red.getJSON("/meta/tableinfo",{name}, json => callback(json));
|
red.getJSON("/meta/tableinfo",{name}, json => callback(json));
|
||||||
},*/
|
},*/
|
||||||
@@ -72,6 +72,9 @@ const meta = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Meta-Table
|
// Meta-Table
|
||||||
|
tableList() {
|
||||||
|
return red.postX('/meta/tablelist')
|
||||||
|
},
|
||||||
itemSort({alias, items}) {
|
itemSort({alias, items}) {
|
||||||
return red.postX('/meta/itemsort', {alias, items: JSON.stringify(items)})
|
return red.postX('/meta/itemsort', {alias, items: JSON.stringify(items)})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -137,7 +137,7 @@
|
|||||||
</row>
|
</row>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
let {getTableList, tableInfo, itemSort, itemUpdate} = meta;
|
let {tableList, tableInfo, itemSort, itemUpdate} = meta;
|
||||||
let {showOk} = red
|
let {showOk} = red
|
||||||
let {dbList} = plat
|
let {dbList} = plat
|
||||||
|
|
||||||
@@ -228,25 +228,10 @@
|
|||||||
});
|
});
|
||||||
vm.oldItems = oldItems;
|
vm.oldItems = oldItems;
|
||||||
})
|
})
|
||||||
|
|
||||||
/*getTableDetail({name: cate}, (json) => {
|
|
||||||
var row = json;
|
|
||||||
vm.meta = row;
|
|
||||||
var oldItems = [];
|
|
||||||
row.items.forEach(function (item) {
|
|
||||||
var d = {};
|
|
||||||
["label", "name", "remark", "type", "inType"].forEach(function (k) {
|
|
||||||
d[k] = item[k];
|
|
||||||
});
|
|
||||||
oldItems.push(d);
|
|
||||||
});
|
|
||||||
vm.oldItems = oldItems;
|
|
||||||
});*/
|
|
||||||
|
|
||||||
},
|
},
|
||||||
tableList() {
|
tableList() {
|
||||||
getTableList(res => {
|
tableList().then(res => {
|
||||||
vm.tables = res;
|
this.tables = res
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
catalogs: function() {
|
catalogs: function() {
|
||||||
@@ -355,30 +340,11 @@
|
|||||||
if (vm.status == 1 && vm.itemSort.length > 0) {
|
if (vm.status == 1 && vm.itemSort.length > 0) {
|
||||||
itemSort({alias: this.alias, items: this.itemSort}).then(() => red.showOk())
|
itemSort({alias: this.alias, items: this.itemSort}).then(() => red.showOk())
|
||||||
|
|
||||||
/*red.postX("/meta/itemsort", {
|
|
||||||
alias: this.alias,
|
|
||||||
items: JSON.stringify(vm.itemSort)
|
|
||||||
}).then(() => showOk())*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (vm.status == 2 && vm.itemEdit.length > 0) {
|
else if (vm.status == 2 && vm.itemEdit.length > 0) {
|
||||||
itemUpdate({alias: this.alias, items: this.itemEdit}).then(() => red.showOk())
|
itemUpdate({alias: this.alias, items: this.itemEdit}).then(() => red.showOk())
|
||||||
|
|
||||||
/*red.postX("/meta/itemupdate", {
|
|
||||||
serviceKey: vm.table,
|
|
||||||
items: JSON.stringify(vm.itemEdit)
|
|
||||||
}).then(() => showOk())*/
|
|
||||||
}
|
}
|
||||||
/*else if (vm.status == 3 || vm.status == 4 || vm.status == 5) {
|
|
||||||
var urls = {3: "/meta/exportsort", 4: "/meta/importsort", 5: "/meta/showsort"};
|
|
||||||
var items = {3: vm.meta.exports, 4: vm.meta.imports, 5: vm.meta.shows};
|
|
||||||
|
|
||||||
red.post(urls[vm.status], {
|
|
||||||
serviceKey: vm.table,
|
|
||||||
items: JSON.stringify(items[vm.status])
|
|
||||||
})
|
|
||||||
}*/
|
|
||||||
|
|
||||||
else if (vm.status == 5) {
|
else if (vm.status == 5) {
|
||||||
red.post("/meta/showsort", {
|
red.post("/meta/showsort", {
|
||||||
serviceKey: vm.table,
|
serviceKey: vm.table,
|
||||||
@@ -407,7 +373,7 @@
|
|||||||
dealTableLabel(table) {
|
dealTableLabel(table) {
|
||||||
return `${table.name} [${table.comment}] (${table.linkCount})`
|
return `${table.name} [${table.comment}] (${table.linkCount})`
|
||||||
},
|
},
|
||||||
getFieldLabel: function (col) {
|
getFieldLabel (col) {
|
||||||
if (!col) {
|
if (!col) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -426,24 +392,7 @@
|
|||||||
dbList().then(res => {
|
dbList().then(res => {
|
||||||
this.dbPlats = res.rows;
|
this.dbPlats = res.rows;
|
||||||
})
|
})
|
||||||
|
|
||||||
this.tableList();
|
this.tableList();
|
||||||
|
|
||||||
/*$(window).keydown(function (event) {
|
|
||||||
// 监听 Ctrl + Enter 可全屏查看
|
|
||||||
if (event.ctrlKey && event.keyCode == 13) {
|
|
||||||
vm.save();
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<!--
|
|
||||||
todo:
|
|
||||||
MetaData,
|
|
||||||
1、Excel导入
|
|
||||||
2、操作数据库表
|
|
||||||
3、关联数据库表
|
|
||||||
|
|
||||||
-->
|
|
||||||
@@ -92,7 +92,19 @@ var red = {
|
|||||||
axios({
|
axios({
|
||||||
url,
|
url,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
params,
|
data: params,
|
||||||
|
transformRequest: [data => {
|
||||||
|
console.log(data)
|
||||||
|
let _data = ''
|
||||||
|
for (k in data) {
|
||||||
|
if (data[k] != undefined) {
|
||||||
|
_data += k + '=' + data[k] + '&'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(_data)
|
||||||
|
return _data
|
||||||
|
}
|
||||||
|
]
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
let data = res.data || {}
|
let data = res.data || {}
|
||||||
red.loginCheck(data)
|
red.loginCheck(data)
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package net.tccn.base;
|
package net.tccn.base;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
import net.tccn.base.arango.Doc;
|
import net.tccn.base.arango.Doc;
|
||||||
import net.tccn.dbq.Field;
|
import net.tccn.dbq.Field;
|
||||||
import net.tccn.dbq.fbean.FilterType;
|
import net.tccn.dbq.fbean.FilterType;
|
||||||
import net.tccn.dbq.jdbc.api.DbAccount;
|
import net.tccn.dbq.jdbc.api.DbAccount;
|
||||||
import net.tccn.dbq.jdbc.api.DbKit;
|
import net.tccn.dbq.jdbc.api.DbKit;
|
||||||
|
import net.tccn.meta.Filter;
|
||||||
import net.tccn.meta.MetaLink;
|
import net.tccn.meta.MetaLink;
|
||||||
import net.tccn.meta.MetaService;
|
import net.tccn.meta.MetaService;
|
||||||
import net.tccn.meta.MetaTable;
|
import net.tccn.meta.MetaTable;
|
||||||
@@ -14,7 +16,6 @@ import org.redkale.util.Comment;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -22,13 +23,18 @@ import java.util.stream.Collectors;
|
|||||||
*
|
*
|
||||||
* Created by liangxianyou at 2019/1/7 13:31.
|
* Created by liangxianyou at 2019/1/7 13:31.
|
||||||
*/
|
*/
|
||||||
public class MetaKit {
|
public final class MetaKit {
|
||||||
//基础数据缓存
|
//基础数据缓存
|
||||||
|
@Getter
|
||||||
private static List<MetaTable> metaTables;
|
private static List<MetaTable> metaTables;
|
||||||
|
@Getter
|
||||||
private static List<MetaLink> metaLinks;
|
private static List<MetaLink> metaLinks;
|
||||||
|
@Getter
|
||||||
private static List<MetaService> metaServices;
|
private static List<MetaService> metaServices;
|
||||||
|
|
||||||
|
@Getter
|
||||||
private static List<DbAccount> dbPlats;
|
private static List<DbAccount> dbPlats;
|
||||||
|
@Getter
|
||||||
private static List<SysPlat> sysPlats;
|
private static List<SysPlat> sysPlats;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@@ -57,47 +63,7 @@ public class MetaKit {
|
|||||||
// todo: 按照key 查询更新内存
|
// todo: 按照key 查询更新内存
|
||||||
}
|
}
|
||||||
|
|
||||||
//----- get/set ----
|
// -----------------------------------
|
||||||
public static List<MetaTable> getMetaTables() {
|
|
||||||
return metaTables;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setMetaTables(List<MetaTable> metaTables) {
|
|
||||||
MetaKit.metaTables = metaTables;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<MetaLink> getMetaLinks() {
|
|
||||||
return metaLinks;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setMetaLinks(List<MetaLink> metaLinks) {
|
|
||||||
MetaKit.metaLinks = metaLinks;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<MetaService> getMetaServices() {
|
|
||||||
return metaServices;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<DbAccount> getDbPlats() {
|
|
||||||
return dbPlats;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setDbPlats(List<DbAccount> dbPlats) {
|
|
||||||
MetaKit.dbPlats = dbPlats;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<SysPlat> getSysPlats() {
|
|
||||||
return sysPlats;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setSysPlats(List<SysPlat> sysPlats) {
|
|
||||||
MetaKit.sysPlats = sysPlats;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------
|
|
||||||
public static void setMetaServices(List<MetaService> metaServices) {
|
|
||||||
MetaKit.metaServices = metaServices;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过 别名 查询 MetaTable
|
* 通过 别名 查询 MetaTable
|
||||||
@@ -150,12 +116,6 @@ public class MetaKit {
|
|||||||
*/
|
*/
|
||||||
public static MetaService getMetaService(String name, String token) {
|
public static MetaService getMetaService(String name, String token) {
|
||||||
Optional<MetaService> service = metaServices.stream().filter(x -> x.getName().equals(name)).findAny();
|
Optional<MetaService> service = metaServices.stream().filter(x -> x.getName().equals(name)).findAny();
|
||||||
//处理业务逻辑
|
|
||||||
service.ifPresent(x -> {
|
|
||||||
//x.setMetaTable(metaTableByAlias(x.getTable()));
|
|
||||||
//x.setMetaLinks(metaLinks(x.getLinks()));
|
|
||||||
//x.setTables(metaTables(x.getMetaLinks()));
|
|
||||||
});
|
|
||||||
return service.orElse(null);
|
return service.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,83 +145,14 @@ public class MetaKit {
|
|||||||
return t;
|
return t;
|
||||||
};
|
};
|
||||||
|
|
||||||
public static Function<String, Field> getField = (n) -> {
|
|
||||||
String[] arr = n.split("[.]");
|
|
||||||
MetaTable metaTable = getMetaTableByAlias(arr[0]);
|
|
||||||
return metaTable.getItems().stream().filter(x -> x.getName().equals(arr[1])).findAny().orElse(null);
|
|
||||||
};
|
|
||||||
|
|
||||||
//listcfg
|
|
||||||
/*public static Function<MetaService, Kv> builderCfg = (m) -> {
|
|
||||||
List<String> shows = m.getShows();
|
|
||||||
List<Map> filters = m.getFilters();
|
|
||||||
|
|
||||||
List<Map> _filters = new ArrayList<>();
|
|
||||||
List<Map> _cols = new ArrayList<>();
|
|
||||||
|
|
||||||
//todo: 优化,批量操作
|
|
||||||
//build shows
|
|
||||||
shows.forEach(x -> {
|
|
||||||
Field field = getField.apply(x);
|
|
||||||
if (field != null) {
|
|
||||||
Kv col = Kv.of();
|
|
||||||
col.set("col", x.split("$]")[0] + field.showField());//a.createtime=dt
|
|
||||||
col.set("label", field.getLabel());
|
|
||||||
col.set("order", 1);//dev 是否支持排序
|
|
||||||
_cols.add(col);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//build filters
|
|
||||||
filters.forEach(x -> {
|
|
||||||
Kv filter = Kv.of();
|
|
||||||
Field filed = getField.apply(x.get("name") + "");
|
|
||||||
|
|
||||||
if (filed != null) {
|
|
||||||
filter.set("name", x.get("name"));
|
|
||||||
filter.set("label", filed.getLabel());
|
|
||||||
}
|
|
||||||
|
|
||||||
filter.set("inType", filed.getInType());
|
|
||||||
filter.set("inExt", filed.getInExt());
|
|
||||||
|
|
||||||
List<Kv> types = new ArrayList<>();
|
|
||||||
List<String> list = (List) x.get("filterType");
|
|
||||||
list.forEach(t -> {
|
|
||||||
FilterType type = FilterType.getFilterType(t);
|
|
||||||
if (type != null) {
|
|
||||||
types.add(Kv.of("name", t).set("remark", type.getRemark()));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
filter.set("filterType", types);
|
|
||||||
Object checked = x.getOrDefault("checked", false);
|
|
||||||
filter.set("checked", checked instanceof Boolean ? checked : false);
|
|
||||||
_filters.add(filter);
|
|
||||||
});
|
|
||||||
|
|
||||||
*//*shows.forEach(x -> {
|
|
||||||
_shows.add(Kv.of("name", x).set("label", getFieldLabel(x)));
|
|
||||||
});*//*
|
|
||||||
|
|
||||||
Kv cfg = Kv.of();
|
|
||||||
cfg.set("title", m.getName())//业务名称
|
|
||||||
//.set("url", getUrl())
|
|
||||||
.set("cols", _cols)//展示的数据列
|
|
||||||
//.set("conditionLabel", "")
|
|
||||||
.set("filters", _filters);//查询过滤条件
|
|
||||||
|
|
||||||
return cfg;
|
|
||||||
};*/
|
|
||||||
|
|
||||||
public static Map cfg(String name, String token) {
|
public static Map cfg(String name, String token) {
|
||||||
MetaService metaService = getMetaService(name, token);
|
MetaService metaService = getMetaService(name, token);
|
||||||
Kv<String, MetaTable> metaTables = getMetaTables(metaService, false);
|
Kv<String, MetaTable> metaTables = getMetaTables(metaService, false);
|
||||||
|
|
||||||
List<Map<String, String>> shows = metaService.getShows();
|
List<Map<String, String>> shows = metaService.getShows();
|
||||||
List<Map> edits = metaService.getEdits();
|
//List<Map> edits = metaService.getEdits();
|
||||||
List<String> details = metaService.getDetails();
|
List<String> details = metaService.getDetails();
|
||||||
List<Map> filters = metaService.getFilters();
|
List<Filter> filters = metaService.getFilters();
|
||||||
String comment = metaService.getComment();
|
String comment = metaService.getComment();
|
||||||
|
|
||||||
//List<Field> items = new ArrayList<>();
|
//List<Field> items = new ArrayList<>();
|
||||||
@@ -293,7 +184,7 @@ public class MetaKit {
|
|||||||
//filters
|
//filters
|
||||||
List<Map> _filters = new ArrayList<>();
|
List<Map> _filters = new ArrayList<>();
|
||||||
filters.forEach(x -> {
|
filters.forEach(x -> {
|
||||||
String col = String.valueOf(x.get("name"));
|
String col = String.valueOf(x.getName());
|
||||||
MetaTable metaTable = metaTables.get(col.split("[.]")[0]); // 表别名
|
MetaTable metaTable = metaTables.get(col.split("[.]")[0]); // 表别名
|
||||||
|
|
||||||
Kv filter = Kv.of();
|
Kv filter = Kv.of();
|
||||||
@@ -301,10 +192,10 @@ public class MetaKit {
|
|||||||
.filter(y -> col.split("[.]")[1].equals(y.getName()))
|
.filter(y -> col.split("[.]")[1].equals(y.getName()))
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.ifPresent(y -> {
|
.ifPresent(y -> {
|
||||||
filter.set("name", x.get("name"));
|
filter.set("name", x.getName());
|
||||||
filter.set("label", x.get("label") != null ? x.get("label") : y.getLabel());
|
filter.set("label", x.getLabel() != null ? x.getLabel() : y.getLabel());
|
||||||
List<Kv> types = new ArrayList<>();
|
List<Kv> types = new ArrayList<>();
|
||||||
List<String> list = (List) x.get("filterType");
|
List<String> list = (List) x.getFilterType();
|
||||||
list.forEach(t -> {
|
list.forEach(t -> {
|
||||||
FilterType type = FilterType.getFilterType(t);
|
FilterType type = FilterType.getFilterType(t);
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
@@ -316,15 +207,14 @@ public class MetaKit {
|
|||||||
if (!types.isEmpty()) {//设置默认查询项
|
if (!types.isEmpty()) {//设置默认查询项
|
||||||
filter.set("type", types.get(0).get("name"));
|
filter.set("type", types.get(0).get("name"));
|
||||||
}
|
}
|
||||||
Object checked = x.getOrDefault("checked", false);
|
filter.set("checked", x.isChecked());
|
||||||
filter.set("checked", checked instanceof Boolean ? checked : false);
|
|
||||||
});
|
});
|
||||||
_filters.add(filter);
|
_filters.add(filter);
|
||||||
});
|
});
|
||||||
|
|
||||||
//edits
|
//edits
|
||||||
List _edits = new ArrayList();//edits;
|
List _edits = new ArrayList();//edits;
|
||||||
edits.forEach(x -> {
|
/*edits.forEach(x -> {
|
||||||
Kv kv = Kv.of();
|
Kv kv = Kv.of();
|
||||||
kv.set("col", x);
|
kv.set("col", x);
|
||||||
|
|
||||||
@@ -348,7 +238,7 @@ public class MetaKit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_edits.add(kv);
|
_edits.add(kv);
|
||||||
});
|
});*/
|
||||||
|
|
||||||
//details
|
//details
|
||||||
List _details = new ArrayList();//details;
|
List _details = new ArrayList();//details;
|
||||||
@@ -460,7 +350,7 @@ public class MetaKit {
|
|||||||
if (!all) {
|
if (!all) {
|
||||||
allAlias = Liangs.streamConcat(
|
allAlias = Liangs.streamConcat(
|
||||||
metaService.getFilters().stream().map(f -> {
|
metaService.getFilters().stream().map(f -> {
|
||||||
String col = (String) f.get("name");
|
String col = (String) f.getName();
|
||||||
String alias = col.split("[.]")[0];
|
String alias = col.split("[.]")[0];
|
||||||
return alias;
|
return alias;
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -22,8 +22,9 @@ public class MetaRender implements HttpRender<HttpScope> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <V extends HttpScope> void renderTo(HttpRequest request, HttpResponse response, Convert convert, V scope) {
|
public <V extends HttpScope> void renderTo(HttpRequest request, HttpResponse response, Convert convert, V scope) {
|
||||||
|
String referid = scope.getReferid();
|
||||||
Map<String, Object> attr = scope.getAttributes();
|
Map<String, Object> attr = scope.getAttributes();
|
||||||
if ("excel".equals(scope.getReferid())) {
|
if ("excel".equals(referid)) {
|
||||||
List list = (List) attr.get("data");
|
List list = (List) attr.get("data");
|
||||||
Kv heads = (Kv) attr.get("heads");
|
Kv heads = (Kv) attr.get("heads");
|
||||||
String fileName = (String) attr.get("fileName");
|
String fileName = (String) attr.get("fileName");
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package net.tccn.dbq;
|
package net.tccn.dbq;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import net.tccn.dbq.table.Column;
|
import net.tccn.dbq.table.Column;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: liangxianyou at 2018/10/17 17:24.
|
* @author: liangxianyou at 2018/10/17 17:24.
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class Field {
|
public class Field {
|
||||||
private String name;
|
private String name;
|
||||||
private String label;
|
private String label;
|
||||||
@@ -14,56 +16,6 @@ public class Field {
|
|||||||
private String inExt;
|
private String inExt;
|
||||||
|
|
||||||
public Field() {}
|
public Field() {}
|
||||||
//============== getter/setter =============
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLabel() {
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLabel(String label) {
|
|
||||||
this.label = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRemark() {
|
|
||||||
return remark;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRemark(String remark) {
|
|
||||||
this.remark = remark;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getInType() {
|
|
||||||
return inType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInType(String inType) {
|
|
||||||
this.inType = inType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getInExt() {
|
|
||||||
return inExt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInExt(String inExt) {
|
|
||||||
this.inExt = inExt;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------
|
//------------------------------------
|
||||||
public enum InType {
|
public enum InType {
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
package net.tccn.dbq.fbean;
|
package net.tccn.dbq.fbean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询用实体
|
* 查询用实体
|
||||||
* @author: liangxianyou at 2018/10/25 14:49.
|
* @author: liangxianyou at 2018/10/25 14:49.
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class FBean {
|
public class FBean {
|
||||||
|
|
||||||
private String platToken; // 平台token
|
private String platToken; // 平台token
|
||||||
@@ -16,78 +19,6 @@ public class FBean {
|
|||||||
private List<Order> orders;//{f1: 1, f2: -1}
|
private List<Order> orders;//{f1: 1, f2: -1}
|
||||||
private Limit limit;//{pn: 1, ps: 10}
|
private Limit limit;//{pn: 1, ps: 10}
|
||||||
|
|
||||||
//---------- getter/setter ------------
|
|
||||||
|
|
||||||
public void setPlatToken(String platToken) {
|
|
||||||
this.platToken = platToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPlatToken() {
|
|
||||||
return platToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Filter> getFilters() {
|
|
||||||
return filters;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFilters(List<Filter> filters) {
|
|
||||||
this.filters = filters;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Order> getOrders() {
|
|
||||||
return orders;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrders(List<Order> orders) {
|
|
||||||
this.orders = orders;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Limit getLimit() {
|
|
||||||
return limit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLimit(Limit limit) {
|
|
||||||
this.limit = limit;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------
|
//-----------------------------------
|
||||||
//组装查询sql,[list, count]
|
|
||||||
@Deprecated
|
|
||||||
public String[] buildSqlFilter() {
|
|
||||||
//where 1=1 and x=1 and y=1 order by x,y limit 1,3;
|
|
||||||
String where = Filter.filter(filters);
|
|
||||||
String order = Order.order(orders, DbType.MYSQL);
|
|
||||||
if (limit == null) {
|
|
||||||
limit = new Limit();
|
|
||||||
}
|
|
||||||
String limit = this.limit.limit();
|
|
||||||
|
|
||||||
String list = where + order + limit;
|
|
||||||
String count = where;
|
|
||||||
return new String[]{list, count};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public void setLimit(int pn, int ps) {
|
|
||||||
limit.setPn(pn);
|
|
||||||
limit.setPs(ps);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,19 @@
|
|||||||
package net.tccn.dbq.fbean;
|
package net.tccn.dbq.fbean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询条件实体
|
* 查询条件实体
|
||||||
* Created by liangxianyou at 2018/12/14 15:34.
|
* Created by liangxianyou at 2018/12/14 15:34.
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class Filter {
|
public class Filter {
|
||||||
private String col;
|
private String col;
|
||||||
private String value;
|
private String value;
|
||||||
private String type;
|
private String type;
|
||||||
|
//----------------------
|
||||||
|
|
||||||
public static Filter by(String col, Object value) {
|
public static Filter by(String col, Object value) {
|
||||||
return by(col, "==", value + "");//todo: == 不是mysql 语法,不具备通用性
|
return by(col, "==", value + "");//todo: == 不是mysql 语法,不具备通用性
|
||||||
@@ -61,29 +65,4 @@ public class Filter {
|
|||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------- getter/setter ------------
|
|
||||||
public String getCol() {
|
|
||||||
return col;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCol(String col) {
|
|
||||||
this.col = col;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValue(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package net.tccn.dbq.fbean;
|
package net.tccn.dbq.fbean;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by liangxianyou at 2018/12/14 15:36.
|
* Created by liangxianyou at 2018/12/14 15:36.
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class Limit {
|
public class Limit {
|
||||||
private int pn;
|
private int pn;
|
||||||
private int ps;
|
private int ps;
|
||||||
@@ -15,6 +18,7 @@ public class Limit {
|
|||||||
this.ps = ps;
|
this.ps = ps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------
|
||||||
public String limit() {
|
public String limit() {
|
||||||
if (pn < 1) {
|
if (pn < 1) {
|
||||||
pn = 1;
|
pn = 1;
|
||||||
@@ -24,21 +28,5 @@ public class Limit {
|
|||||||
}
|
}
|
||||||
return String.format(" LIMIT %s, %s", (pn - 1) * ps, ps);
|
return String.format(" LIMIT %s, %s", (pn - 1) * ps, ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---- getter/setter -----
|
|
||||||
public int getPn() {
|
|
||||||
return pn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPn(int pn) {
|
|
||||||
this.pn = pn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getPs() {
|
|
||||||
return ps;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPs(int ps) {
|
|
||||||
this.ps = ps;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ public class Order {
|
|||||||
this.col = col;
|
this.col = col;
|
||||||
this.desc = desc;
|
this.desc = desc;
|
||||||
}
|
}
|
||||||
|
// --------------------------------
|
||||||
|
|
||||||
public static String order(List<Order> orders, DbType dbType) {
|
public static String order(List<Order> orders, DbType dbType) {
|
||||||
if (orders == null || orders.size() == 0) {
|
if (orders == null || orders.size() == 0) {
|
||||||
@@ -38,21 +39,4 @@ public class Order {
|
|||||||
|
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--- getter/setter ---
|
|
||||||
public String getCol() {
|
|
||||||
return col;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCol(String col) {
|
|
||||||
this.col = col;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDesc() {
|
|
||||||
return desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDesc(int desc) {
|
|
||||||
this.desc = desc;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package net.tccn.dbq.jdbc.api;
|
package net.tccn.dbq.jdbc.api;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import net.tccn.base.arango.Doc;
|
import net.tccn.base.arango.Doc;
|
||||||
import org.redkale.convert.json.JsonConvert;
|
|
||||||
|
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -10,7 +10,7 @@ import java.util.List;
|
|||||||
* 数据库平台
|
* 数据库平台
|
||||||
* @author: liangxianyou at 2018/11/14 12:58.
|
* @author: liangxianyou at 2018/11/14 12:58.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("Duplicates")
|
@Data
|
||||||
@Table(name = "db_plat", catalog = "db_dev")
|
@Table(name = "db_plat", catalog = "db_dev")
|
||||||
public class DbAccount extends Doc<DbAccount> {
|
public class DbAccount extends Doc<DbAccount> {
|
||||||
public static DbAccount dao = dao(DbAccount.class);
|
public static DbAccount dao = dao(DbAccount.class);
|
||||||
@@ -23,76 +23,7 @@ public class DbAccount extends Doc<DbAccount> {
|
|||||||
private String pwd; //密码
|
private String pwd; //密码
|
||||||
private List<String> catalogs; //库
|
private List<String> catalogs; //库
|
||||||
|
|
||||||
//private JdbcAccount jdbcAccount;
|
//----------------------------
|
||||||
//------------- setter/getter ---------------
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCate() {
|
|
||||||
return cate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCate(String cate) {
|
|
||||||
this.cate = cate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRemark() {
|
|
||||||
return remark;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRemark(String remark) {
|
|
||||||
this.remark = remark;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUrl(String url) {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUser() {
|
|
||||||
return user;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUser(String user) {
|
|
||||||
this.user = user;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPwd() {
|
|
||||||
return pwd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPwd(String pwd) {
|
|
||||||
this.pwd = pwd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getCatalogs() {
|
|
||||||
return catalogs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCatalogs(List<String> catalogs) {
|
|
||||||
this.catalogs = catalogs;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return JsonConvert.root().convertTo(this);
|
|
||||||
}
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/*protected Connection connection() throws SQLException {
|
|
||||||
if (jdbcAccount == null) {
|
|
||||||
jdbcAccount = new JdbcAccount(url, user, pwd);
|
|
||||||
}
|
|
||||||
return jdbcAccount.getConnection();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
public String accountKey() {
|
public String accountKey() {
|
||||||
int start = url.indexOf("//") + 2;
|
int start = url.indexOf("//") + 2;
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
/**
|
/**
|
||||||
* Created by liangxianyou at 2019/3/12 14:20.
|
* Created by liangxianyou at 2019/3/12 14:20.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("Duplicates")
|
|
||||||
public class DbSourceMysql implements DbSource {
|
public class DbSourceMysql implements DbSource {
|
||||||
|
|
||||||
private static ConcurrentHashMap<String, LinkedBlockingQueue<Connection>> conns = new ConcurrentHashMap<>();
|
private static ConcurrentHashMap<String, LinkedBlockingQueue<Connection>> conns = new ConcurrentHashMap<>();
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.tccn.dbq.qtask;
|
package net.tccn.dbq.qtask;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import net.tccn.base.arango.Doc;
|
import net.tccn.base.arango.Doc;
|
||||||
|
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
@@ -7,6 +8,7 @@ import javax.persistence.Table;
|
|||||||
/**
|
/**
|
||||||
* @author: liangxianyou at 2018/11/13 14:59.
|
* @author: liangxianyou at 2018/11/13 14:59.
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
@Table(name = "qtask", catalog = "db_dev")
|
@Table(name = "qtask", catalog = "db_dev")
|
||||||
public class Qtask extends Doc<Qtask> {
|
public class Qtask extends Doc<Qtask> {
|
||||||
public static Qtask dao = dao(Qtask.class);
|
public static Qtask dao = dao(Qtask.class);
|
||||||
@@ -22,84 +24,6 @@ public class Qtask extends Doc<Qtask> {
|
|||||||
private String catalog; //数据库名
|
private String catalog; //数据库名
|
||||||
private Integer status; //状态 1启用|0未启用|-1删除
|
private Integer status; //状态 1启用|0未启用|-1删除
|
||||||
|
|
||||||
//------------- setter/getter ------------------------
|
//-------------------------------------
|
||||||
public String getQueryId() {
|
|
||||||
return queryId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQueryId(String queryId) {
|
|
||||||
this.queryId = queryId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRemark() {
|
|
||||||
return remark;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRemark(String remark) {
|
|
||||||
this.remark = remark;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSql() {
|
|
||||||
return sql;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSql(String sql) {
|
|
||||||
this.sql = sql;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPara() {
|
|
||||||
return para;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPara(String para) {
|
|
||||||
this.para = para;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCate() {
|
|
||||||
return cate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCate(String cate) {
|
|
||||||
this.cate = cate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getSysPlatId() {
|
|
||||||
return sysPlatId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSysPlatId(Integer sysPlatId) {
|
|
||||||
this.sysPlatId = sysPlatId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getPlatId() {
|
|
||||||
return platId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPlatId(Integer platId) {
|
|
||||||
this.platId = platId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCatalog() {
|
|
||||||
return catalog;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCatalog(String catalog) {
|
|
||||||
this.catalog = catalog;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(Integer status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package net.tccn.dbq.table;
|
package net.tccn.dbq.table;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据库表的列
|
* 数据库表的列
|
||||||
* @author: liangxianyou at 2018/10/8 10:59.
|
* @author: liangxianyou at 2018/10/8 10:59.
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class Column {
|
public class Column {
|
||||||
private String field; //列名称
|
private String field; //列名称
|
||||||
private String type; //列类型
|
private String type; //列类型
|
||||||
@@ -20,38 +23,6 @@ public class Column {
|
|||||||
this.comment = comment;
|
this.comment = comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getField() {
|
|
||||||
return field;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setField(String field) {
|
|
||||||
this.field = field;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setType(String type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getNotNull() {
|
|
||||||
return notNull;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNotNull(boolean notNull) {
|
|
||||||
this.notNull = notNull;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getComment() {
|
|
||||||
return comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setComment(String comment) {
|
|
||||||
this.comment = comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------
|
//-----------------------
|
||||||
public void setNull(String notNull) {
|
public void setNull(String notNull) {
|
||||||
this.notNull = "NO".equalsIgnoreCase(notNull) ? true : false;
|
this.notNull = "NO".equalsIgnoreCase(notNull) ? true : false;
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package net.tccn.dbq.table;
|
package net.tccn.dbq.table;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -8,6 +10,7 @@ import java.util.List;
|
|||||||
* 数据库表.
|
* 数据库表.
|
||||||
* @author: liangxianyou at 2018/10/8 10:58.
|
* @author: liangxianyou at 2018/10/8 10:58.
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class Table {
|
public class Table {
|
||||||
private String catalog; //库名称
|
private String catalog; //库名称
|
||||||
private String name; //表名称
|
private String name; //表名称
|
||||||
@@ -20,40 +23,6 @@ public class Table {
|
|||||||
this.comment = comment;
|
this.comment = comment;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------ getter/setter -------------
|
|
||||||
|
|
||||||
public String getCatalog() {
|
|
||||||
return catalog;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCatalog(String catalog) {
|
|
||||||
this.catalog = catalog;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getComment() {
|
|
||||||
return comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setComment(String comment) {
|
|
||||||
this.comment = comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Column> getColumns() {
|
|
||||||
return columns;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setColumns(List<Column> columns) {
|
|
||||||
this.columns = columns;
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------
|
//------------------------------
|
||||||
|
|
||||||
//Dev
|
//Dev
|
||||||
|
|||||||
16
src/main/java/net/tccn/meta/Filter.java
Normal file
16
src/main/java/net/tccn/meta/Filter.java
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package net.tccn.meta;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: liangxianyou
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class Filter {
|
||||||
|
private String name;
|
||||||
|
private String label;
|
||||||
|
private boolean checked;
|
||||||
|
private List<String> filterType;
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.tccn.meta;
|
package net.tccn.meta;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import net.tccn.base.arango.Doc;
|
import net.tccn.base.arango.Doc;
|
||||||
|
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
@@ -8,29 +9,11 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* Created by liangxianyou at 2018/12/25 16:22.
|
* Created by liangxianyou at 2018/12/25 16:22.
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
@Table(name = "MetaLink", catalog = "db_demo")
|
@Table(name = "MetaLink", catalog = "db_demo")
|
||||||
public class MetaLink extends Doc<MetaLink> {
|
public class MetaLink extends Doc<MetaLink> {
|
||||||
public static MetaLink dao = Doc.dao(MetaLink.class);
|
public static MetaLink dao = Doc.dao(MetaLink.class);
|
||||||
|
|
||||||
private String[] tables;
|
private String[] tables;
|
||||||
private Map<String, String> link;
|
private Map<String, String> link;
|
||||||
|
|
||||||
//-------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
public String[] getTables() {
|
|
||||||
return tables;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTables(String[] tables) {
|
|
||||||
this.tables = tables;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map getLink() {
|
|
||||||
return link;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLink(Map<String, String> link) {
|
|
||||||
this.link = link;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.tccn.meta;
|
package net.tccn.meta;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import net.tccn.base.arango.Doc;
|
import net.tccn.base.arango.Doc;
|
||||||
|
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
@@ -10,6 +11,7 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* Created by liangxianyou at 2018/12/24 16:15.
|
* Created by liangxianyou at 2018/12/24 16:15.
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
@Table(name = "MetaService", catalog = "db_demo")
|
@Table(name = "MetaService", catalog = "db_demo")
|
||||||
public class MetaService extends Doc<MetaService> {
|
public class MetaService extends Doc<MetaService> {
|
||||||
public static MetaService dao = Doc.dao(MetaService.class);
|
public static MetaService dao = Doc.dao(MetaService.class);
|
||||||
@@ -20,82 +22,11 @@ public class MetaService extends Doc<MetaService> {
|
|||||||
private String sysPlatId; //平台id
|
private String sysPlatId; //平台id
|
||||||
|
|
||||||
private List<Map<String,String>> shows = new ArrayList<>();
|
private List<Map<String,String>> shows = new ArrayList<>();
|
||||||
private List<Map> edits = new ArrayList<>();
|
private List<Map<String,String>> edits = new ArrayList<>();
|
||||||
private List<String> details = new ArrayList<>();
|
private List<String> details = new ArrayList<>();
|
||||||
private List<Map> filters = new ArrayList<>();
|
private List<Filter> filters = new ArrayList<>();//{name:"", label:"", checked:true, }
|
||||||
private List<Map<String,String>> exports = new ArrayList<>();
|
private List<Map<String,String>> exports = new ArrayList<>();
|
||||||
|
|
||||||
//-------------------------------------------
|
//------
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTable() {
|
|
||||||
return table;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTable(String table) {
|
|
||||||
this.table = table;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getComment() {
|
|
||||||
return comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setComment(String comment) {
|
|
||||||
this.comment = comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSysPlatId() {
|
|
||||||
return sysPlatId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSysPlatId(String sysPlatId) {
|
|
||||||
this.sysPlatId = sysPlatId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Map<String, String>> getShows() {
|
|
||||||
return shows;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setShows(List<Map<String, String>> shows) {
|
|
||||||
this.shows = shows;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Map> getEdits() {
|
|
||||||
return edits;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEdits(List<Map> edits) {
|
|
||||||
this.edits = edits;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getDetails() {
|
|
||||||
return details;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDetails(List<String> details) {
|
|
||||||
this.details = details;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Map> getFilters() {
|
|
||||||
return filters;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFilters(List<Map> filters) {
|
|
||||||
this.filters = filters;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Map<String, String>> getExports() {
|
|
||||||
return exports;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setExports(List<Map<String, String>> exports) {
|
|
||||||
this.exports = exports;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.tccn.meta;
|
package net.tccn.meta;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import net.tccn.base.arango.Doc;
|
import net.tccn.base.arango.Doc;
|
||||||
import net.tccn.dbq.Field;
|
import net.tccn.dbq.Field;
|
||||||
|
|
||||||
@@ -13,6 +14,7 @@ import java.util.stream.Collectors;
|
|||||||
*
|
*
|
||||||
* @author: liangxianyou at 2018/10/17 12:58.
|
* @author: liangxianyou at 2018/10/17 12:58.
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
@Table(name = "MetaTable", catalog = "db_demo")
|
@Table(name = "MetaTable", catalog = "db_demo")
|
||||||
public class MetaTable extends Doc<MetaTable> implements Serializable {
|
public class MetaTable extends Doc<MetaTable> implements Serializable {
|
||||||
public static final MetaTable dao = MetaTable.dao(MetaTable.class);
|
public static final MetaTable dao = MetaTable.dao(MetaTable.class);
|
||||||
@@ -26,72 +28,6 @@ public class MetaTable extends Doc<MetaTable> implements Serializable {
|
|||||||
private String catalog; //所在database
|
private String catalog; //所在database
|
||||||
|
|
||||||
private Integer hv;//临时
|
private Integer hv;//临时
|
||||||
//=============== getter/setter ============
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAlias() {
|
|
||||||
return alias;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAlias(String alias) {
|
|
||||||
this.alias = alias;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getComment() {
|
|
||||||
return comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setComment(String comment) {
|
|
||||||
this.comment = comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Field> getItems() {
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItems(List<Field> items) {
|
|
||||||
this.items = items;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSysPlatId() {
|
|
||||||
return sysPlatId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSysPlatId(String sysPlatId) {
|
|
||||||
this.sysPlatId = sysPlatId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDbPlatId() {
|
|
||||||
return dbPlatId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDbPlatId(String dbPlatId) {
|
|
||||||
this.dbPlatId = dbPlatId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCatalog() {
|
|
||||||
return catalog;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCatalog(String catalog) {
|
|
||||||
this.catalog = catalog;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getHv() {
|
|
||||||
return hv;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHv(Integer hv) {
|
|
||||||
this.hv = hv;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------
|
// ------------------------------------------------
|
||||||
public static MetaTable toAs(net.tccn.dbq.table.Table table) {
|
public static MetaTable toAs(net.tccn.dbq.table.Table table) {
|
||||||
List<Field> fields = table.getColumns().stream().map(Field::toAs).collect(Collectors.toList());
|
List<Field> fields = table.getColumns().stream().map(Field::toAs).collect(Collectors.toList());
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package net.tccn.plat;
|
package net.tccn.plat;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import net.tccn.base.arango.Doc;
|
import net.tccn.base.arango.Doc;
|
||||||
import org.redkale.convert.json.JsonConvert;
|
|
||||||
|
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -10,6 +10,7 @@ import java.util.List;
|
|||||||
* 数据库平台
|
* 数据库平台
|
||||||
* @author: liangxianyou at 2018/11/14 12:58.
|
* @author: liangxianyou at 2018/11/14 12:58.
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
@Table(name = "db_plat", catalog = "db_dev")
|
@Table(name = "db_plat", catalog = "db_dev")
|
||||||
public class DbPlat extends Doc<DbPlat> {
|
public class DbPlat extends Doc<DbPlat> {
|
||||||
public static DbPlat dao = dao(DbPlat.class);
|
public static DbPlat dao = dao(DbPlat.class);
|
||||||
@@ -22,75 +23,4 @@ public class DbPlat extends Doc<DbPlat> {
|
|||||||
private String pwd; //密码
|
private String pwd; //密码
|
||||||
private List<String> catalogs; //库
|
private List<String> catalogs; //库
|
||||||
private Integer status;//状态 1启用, 0 未启用
|
private Integer status;//状态 1启用, 0 未启用
|
||||||
|
|
||||||
//------------- setter/getter ---------------
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCate() {
|
|
||||||
return cate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCate(String cate) {
|
|
||||||
this.cate = cate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRemark() {
|
|
||||||
return remark;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRemark(String remark) {
|
|
||||||
this.remark = remark;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUrl(String url) {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUser() {
|
|
||||||
return user;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUser(String user) {
|
|
||||||
this.user = user;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPwd() {
|
|
||||||
return pwd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPwd(String pwd) {
|
|
||||||
this.pwd = pwd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getCatalogs() {
|
|
||||||
return catalogs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCatalogs(List<String> catalogs) {
|
|
||||||
this.catalogs = catalogs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(Integer status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return JsonConvert.root().convertTo(this);
|
|
||||||
}
|
|
||||||
//-------------------------------------------------------------------------
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.tccn.plat;
|
package net.tccn.plat;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import net.tccn.base.arango.Doc;
|
import net.tccn.base.arango.Doc;
|
||||||
|
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
@@ -7,6 +8,7 @@ import javax.persistence.Table;
|
|||||||
/**
|
/**
|
||||||
* @author: liangxianyou at 2018/11/26 17:46.
|
* @author: liangxianyou at 2018/11/26 17:46.
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
@Table(name = "sys_plat", catalog = "db_dev")
|
@Table(name = "sys_plat", catalog = "db_dev")
|
||||||
public class SysPlat extends Doc<SysPlat> {
|
public class SysPlat extends Doc<SysPlat> {
|
||||||
public static SysPlat dao = dao(SysPlat.class);
|
public static SysPlat dao = dao(SysPlat.class);
|
||||||
@@ -21,19 +23,4 @@ public class SysPlat extends Doc<SysPlat> {
|
|||||||
this.token = token;
|
this.token = token;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getToken() {
|
|
||||||
return token;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setToken(String token) {
|
|
||||||
this.token = token;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
package net.tccn.qtask;
|
package net.tccn.qtask;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import net.tccn.base.Kv;
|
import net.tccn.base.Kv;
|
||||||
import net.tccn.dbq.jdbc.api.DbAccount;
|
import net.tccn.dbq.jdbc.api.DbAccount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* |- dbp: 调用谁, 参数,
|
||||||
|
* |- 谁:谁(干什么) => dbPlatId + content (在程序的世界每个个体,往往都有其明确的职责)
|
||||||
|
* |-
|
||||||
* 任务对象
|
* 任务对象
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class Task {
|
public class Task {
|
||||||
/*
|
|
||||||
|- dbp: 调用谁, 参数,
|
|
||||||
|- 谁:谁(干什么) => dbPlatId + content (在程序的世界每个个体,往往都有其明确的职责)
|
|
||||||
|-
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
private String name; // 任务名,同一系统唯一
|
private String name; // 任务名,同一系统唯一
|
||||||
private String dbPlatId; // 数据源id
|
private String dbPlatId; // 数据源id
|
||||||
@@ -25,60 +23,4 @@ public class Task {
|
|||||||
|
|
||||||
private DbAccount dbAccount;
|
private DbAccount dbAccount;
|
||||||
|
|
||||||
//------------------
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDbPlatId() {
|
|
||||||
return dbPlatId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDbPlatId(String dbPlatId) {
|
|
||||||
this.dbPlatId = dbPlatId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCatalog() {
|
|
||||||
return catalog;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCatalog(String catalog) {
|
|
||||||
this.catalog = catalog;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContent() {
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setContent(String content) {
|
|
||||||
this.content = content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getComment() {
|
|
||||||
return comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setComment(String comment) {
|
|
||||||
this.comment = comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Kv getPara() {
|
|
||||||
return para;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPara(Kv para) {
|
|
||||||
this.para = para;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DbAccount getDbAccount() {
|
|
||||||
return dbAccount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDbAccount(DbAccount dbAccount) {
|
|
||||||
this.dbAccount = dbAccount;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.tccn.qtask;
|
package net.tccn.qtask;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import net.tccn.base.arango.Doc;
|
import net.tccn.base.arango.Doc;
|
||||||
|
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
@@ -7,6 +8,7 @@ import javax.persistence.Table;
|
|||||||
/**
|
/**
|
||||||
* Created by liangxianyou at 2019/4/20 20:04.
|
* Created by liangxianyou at 2019/4/20 20:04.
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
@Table(name = "qtask", catalog = "db_demo")
|
@Table(name = "qtask", catalog = "db_demo")
|
||||||
public class TaskEntity extends Doc<TaskEntity> {
|
public class TaskEntity extends Doc<TaskEntity> {
|
||||||
public static TaskEntity dao = dao(TaskEntity.class);
|
public static TaskEntity dao = dao(TaskEntity.class);
|
||||||
@@ -22,61 +24,4 @@ public class TaskEntity extends Doc<TaskEntity> {
|
|||||||
private String sysPlatId; // 平台id
|
private String sysPlatId; // 平台id
|
||||||
|
|
||||||
// ---------------------
|
// ---------------------
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDbPlatId() {
|
|
||||||
return dbPlatId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDbPlatId(String dbPlatId) {
|
|
||||||
this.dbPlatId = dbPlatId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCatalog() {
|
|
||||||
return catalog;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCatalog(String catalog) {
|
|
||||||
this.catalog = catalog;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getComment() {
|
|
||||||
return comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setComment(String comment) {
|
|
||||||
this.comment = comment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContent() {
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setContent(String content) {
|
|
||||||
this.content = content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPara() {
|
|
||||||
return para;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPara(String para) {
|
|
||||||
this.para = para;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSysPlatId() {
|
|
||||||
return sysPlatId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSysPlatId(String sysPlatId) {
|
|
||||||
this.sysPlatId = sysPlatId;
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package net.tccn.qtask;
|
package net.tccn.qtask;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import net.tccn.base.Kv;
|
import net.tccn.base.Kv;
|
||||||
import net.tccn.base.MetaKit;
|
import net.tccn.base.MetaKit;
|
||||||
|
import org.redkale.convert.json.JsonConvert;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -13,6 +13,7 @@ import java.util.Optional;
|
|||||||
* Created by liangxianyou at 2019/4/20 19:59.
|
* Created by liangxianyou at 2019/4/20 19:59.
|
||||||
*/
|
*/
|
||||||
public class TaskKit {
|
public class TaskKit {
|
||||||
|
static final JsonConvert convert = JsonConvert.root();
|
||||||
private static List<TaskEntity> taskEntities;
|
private static List<TaskEntity> taskEntities;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@@ -35,7 +36,7 @@ public class TaskKit {
|
|||||||
Kv _para = Kv.of().putAll(para);
|
Kv _para = Kv.of().putAll(para);
|
||||||
if (taskEntity.getPara() != null) {
|
if (taskEntity.getPara() != null) {
|
||||||
try {
|
try {
|
||||||
Map map = new Gson().fromJson(taskEntity.getPara(), Map.class);
|
Map<String, String> map = convert.convertFrom(JsonConvert.TYPE_MAP_STRING_STRING, taskEntity.getPara());
|
||||||
map.forEach((k,v) -> _para.put(k, v));
|
map.forEach((k,v) -> _para.put(k, v));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
new IllegalArgumentException(String.format("fromJson error:[%s]",taskEntity.getPara()), e);
|
new IllegalArgumentException(String.format("fromJson error:[%s]",taskEntity.getPara()), e);
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package net.tccn.service;
|
package net.tccn.service;
|
||||||
|
|
||||||
import com.arangodb.Predicate;
|
import com.arangodb.Predicate;
|
||||||
import com.google.gson.Gson;
|
|
||||||
import net.tccn.base.FileKit;
|
import net.tccn.base.FileKit;
|
||||||
import net.tccn.base.MetaKit;
|
import net.tccn.base.MetaKit;
|
||||||
import net.tccn.base.TplKit;
|
import net.tccn.base.TplKit;
|
||||||
|
import org.redkale.convert.json.JsonConvert;
|
||||||
import org.redkale.net.http.RestMapping;
|
import org.redkale.net.http.RestMapping;
|
||||||
import org.redkale.service.Service;
|
import org.redkale.service.Service;
|
||||||
import org.redkale.source.CacheSource;
|
import org.redkale.source.CacheSource;
|
||||||
@@ -26,10 +26,12 @@ import java.util.logging.Logger;
|
|||||||
*/
|
*/
|
||||||
public class BaseService implements Service {
|
public class BaseService implements Service {
|
||||||
|
|
||||||
|
protected final static JsonConvert convert = JsonConvert.root();
|
||||||
|
|
||||||
@Resource(name = "SERVER_ROOT")
|
@Resource(name = "SERVER_ROOT")
|
||||||
protected File webroot;
|
protected File webroot;
|
||||||
|
|
||||||
public static Gson gson = new Gson();
|
|
||||||
public Logger logger = Logger.getLogger(this.getClass().getSimpleName());
|
public Logger logger = Logger.getLogger(this.getClass().getSimpleName());
|
||||||
|
|
||||||
public static Predicate isEmpty = (x) -> {
|
public static Predicate isEmpty = (x) -> {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import net.tccn.base.JBean;
|
|||||||
import net.tccn.base.Kv;
|
import net.tccn.base.Kv;
|
||||||
import net.tccn.base.MetaKit;
|
import net.tccn.base.MetaKit;
|
||||||
import net.tccn.dbq.Field;
|
import net.tccn.dbq.Field;
|
||||||
|
import net.tccn.meta.Filter;
|
||||||
import net.tccn.meta.MetaLink;
|
import net.tccn.meta.MetaLink;
|
||||||
import net.tccn.meta.MetaService;
|
import net.tccn.meta.MetaService;
|
||||||
import net.tccn.meta.MetaTable;
|
import net.tccn.meta.MetaTable;
|
||||||
@@ -27,8 +28,7 @@ public class MetadataService extends BaseService { //arango
|
|||||||
public JBean tableList(@RestParam(name = "platToken") String token, String catalog, String dbPlatId, String name) {
|
public JBean tableList(@RestParam(name = "platToken") String token, String catalog, String dbPlatId, String name) {
|
||||||
JBean jBean = new JBean();
|
JBean jBean = new JBean();
|
||||||
|
|
||||||
List<Kv> list =
|
List<Kv> list = MetaKit.getMetaTables().stream().filter(x ->
|
||||||
MetaKit.getMetaTables().stream().filter(x ->
|
|
||||||
(isEmpty.test(catalog) || catalog.equals(x.getCatalog())) &&
|
(isEmpty.test(catalog) || catalog.equals(x.getCatalog())) &&
|
||||||
(isEmpty.test(dbPlatId) || dbPlatId.equals(x.getDbPlatId())) &&
|
(isEmpty.test(dbPlatId) || dbPlatId.equals(x.getDbPlatId())) &&
|
||||||
(isEmpty.test(name) || x.getName().contains(name)) &&
|
(isEmpty.test(name) || x.getName().contains(name)) &&
|
||||||
@@ -43,8 +43,7 @@ public class MetadataService extends BaseService { //arango
|
|||||||
return x.getAlias().equals(tables[0]) || x.getAlias().equals(tables[1]);
|
return x.getAlias().equals(tables[0]) || x.getAlias().equals(tables[1]);
|
||||||
}).count())
|
}).count())
|
||||||
).collect(Collectors.toList());
|
).collect(Collectors.toList());
|
||||||
jBean.setBody(list);
|
return jBean.setBody(list);
|
||||||
return jBean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -76,11 +75,8 @@ public class MetadataService extends BaseService { //arango
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RestMapping(name = "service_save", comment = "service信息保存")
|
@RestMapping(name = "service_save", comment = "service信息保存")
|
||||||
public JBean serviceSave(@RestParam(name = "platToken") String token, @RestParam(name = "service") String serviceBean) {
|
public JBean serviceSave(@RestParam(name = "platToken") String token, @RestParam(name = "service") MetaService service) {
|
||||||
JBean jBean = new JBean();
|
JBean jBean = new JBean();
|
||||||
|
|
||||||
MetaService service = gson.fromJson(serviceBean, MetaService.class);
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
// 标识码非空校验
|
// 标识码非空校验
|
||||||
if (isEmpty.test(service.getTable())) {
|
if (isEmpty.test(service.getTable())) {
|
||||||
@@ -196,12 +192,9 @@ public class MetadataService extends BaseService { //arango
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RestMapping(name = "filter_update", comment = "查询配置修改")
|
@RestMapping(name = "filter_update", comment = "查询配置修改")
|
||||||
public JBean filterUpdate(@RestParam(name = "name") String name,
|
public JBean filterUpdate(String name, List<Filter> filters, @RestParam(name = "platToken") String token) {
|
||||||
@RestParam(name = "filters") String filters,
|
|
||||||
@RestParam(name = "platToken") String token) {
|
|
||||||
List _filters = gson.fromJson(filters, List.class);
|
|
||||||
MetaService metaService = MetaKit.getMetaService(name, token);
|
MetaService metaService = MetaKit.getMetaService(name, token);
|
||||||
metaService.setFilters(_filters);
|
metaService.setFilters(filters);
|
||||||
|
|
||||||
metaService.update();
|
metaService.update();
|
||||||
return JBean.by(0, "");
|
return JBean.by(0, "");
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package net.tccn.servlet;
|
package net.tccn.servlet;
|
||||||
|
|
||||||
import com.arangodb.ArangoDBException;
|
import com.arangodb.ArangoDBException;
|
||||||
import com.google.gson.Gson;
|
|
||||||
import net.tccn.base.JBean;
|
import net.tccn.base.JBean;
|
||||||
import net.tccn.base.Kv;
|
import net.tccn.base.Kv;
|
||||||
import net.tccn.base.arango.ArangoSource;
|
import net.tccn.base.arango.ArangoSource;
|
||||||
@@ -9,7 +8,6 @@ import net.tccn.service.UserService;
|
|||||||
import net.tccn.user.User;
|
import net.tccn.user.User;
|
||||||
import org.redkale.net.http.HttpRequest;
|
import org.redkale.net.http.HttpRequest;
|
||||||
import org.redkale.net.http.HttpResponse;
|
import org.redkale.net.http.HttpResponse;
|
||||||
import org.redkale.net.http.HttpScope;
|
|
||||||
import org.redkale.net.http.HttpServlet;
|
import org.redkale.net.http.HttpServlet;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -26,7 +24,6 @@ public class BaseServlet extends HttpServlet {
|
|||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
|
||||||
public Logger logger = Logger.getLogger(this.getClass().getSimpleName());
|
public Logger logger = Logger.getLogger(this.getClass().getSimpleName());
|
||||||
protected static Gson gson = new Gson();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void preExecute(HttpRequest request, HttpResponse response) throws IOException {
|
protected void preExecute(HttpRequest request, HttpResponse response) throws IOException {
|
||||||
@@ -50,10 +47,13 @@ public class BaseServlet extends HttpServlet {
|
|||||||
protected void authenticate(HttpRequest request, HttpResponse response) throws IOException {
|
protected void authenticate(HttpRequest request, HttpResponse response) throws IOException {
|
||||||
//fixme: 权限拦截
|
//fixme: 权限拦截
|
||||||
if (request.currentUser() == null) {
|
if (request.currentUser() == null) {
|
||||||
if ("XMLHttpRequest".equals(request.getHeader("X-Requested-With"))){
|
String accept = request.getHeader("Accept");
|
||||||
|
if ("XMLHttpRequest".equals(request.getHeader("X-Requested-With")) || (accept != null && accept.contains("application/json"))) {
|
||||||
response.finish(JBean.by(-2, "未登陆"));
|
response.finish(JBean.by(-2, "未登陆"));
|
||||||
}else {
|
} else {
|
||||||
response.finish(HttpScope.refer("/user/login.html"));
|
response.setStatus(302);
|
||||||
|
response.setHeader("location", "/user/login.html");
|
||||||
|
response.finish();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package net.tccn.user;
|
package net.tccn.user;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import net.tccn.base.JBean;
|
import net.tccn.base.JBean;
|
||||||
import net.tccn.base.arango.Doc;
|
import net.tccn.base.arango.Doc;
|
||||||
import org.redkale.convert.ConvertColumn;
|
import org.redkale.convert.ConvertColumn;
|
||||||
import org.redkale.convert.ConvertType;
|
import org.redkale.convert.ConvertType;
|
||||||
import org.redkale.convert.json.JsonConvert;
|
|
||||||
import org.redkale.util.Utility;
|
import org.redkale.util.Utility;
|
||||||
|
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
@@ -12,11 +12,13 @@ import javax.persistence.Table;
|
|||||||
/**
|
/**
|
||||||
* @author: liangxianyou at 2018/11/22 17:37.
|
* @author: liangxianyou at 2018/11/22 17:37.
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
@Table(name = "sys_user", catalog = "db_dev")
|
@Table(name = "sys_user", catalog = "db_dev")
|
||||||
public class User extends Doc<User> {
|
public class User extends Doc<User> {
|
||||||
public static User dao = dao(User.class);
|
public static User dao = dao(User.class);
|
||||||
|
|
||||||
private String username;
|
private String username;
|
||||||
|
@ConvertColumn(ignore = true,type = ConvertType.JSON)
|
||||||
private String pwd;
|
private String pwd;
|
||||||
private Long createTime;
|
private Long createTime;
|
||||||
private Long loginTime;
|
private Long loginTime;
|
||||||
@@ -29,61 +31,6 @@ public class User extends Doc<User> {
|
|||||||
public User(String sessionid) {
|
public User(String sessionid) {
|
||||||
this.sessionid = sessionid;
|
this.sessionid = sessionid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUsername() {
|
|
||||||
return username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUsername(String username) {
|
|
||||||
this.username = username;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ConvertColumn(ignore = true,type = ConvertType.JSON)
|
|
||||||
public String getPwd() {
|
|
||||||
return pwd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPwd(String pwd) {
|
|
||||||
this.pwd = pwd;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getCreateTime() {
|
|
||||||
return createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreateTime(Long createTime) {
|
|
||||||
this.createTime = createTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getLoginTime() {
|
|
||||||
return loginTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLoginTime(Long loginTime) {
|
|
||||||
this.loginTime = loginTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(Integer status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSessionid() {
|
|
||||||
return sessionid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSessionid(String sessionid) {
|
|
||||||
this.sessionid = sessionid;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return JsonConvert.root().convertTo(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------
|
//-------------------------------
|
||||||
|
|
||||||
public static String md5IfNeed(String password){
|
public static String md5IfNeed(String password){
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import com.google.gson.Gson;
|
|
||||||
import net.tccn.base.FileKit;
|
import net.tccn.base.FileKit;
|
||||||
import net.tccn.base.Kv;
|
import net.tccn.base.Kv;
|
||||||
import net.tccn.base.MetaKit;
|
import net.tccn.base.MetaKit;
|
||||||
@@ -7,11 +6,13 @@ import net.tccn.dbq.fbean.FBean;
|
|||||||
import net.tccn.dbq.jdbc.api.DbAccount;
|
import net.tccn.dbq.jdbc.api.DbAccount;
|
||||||
import net.tccn.dbq.jdbc.api.DbKit;
|
import net.tccn.dbq.jdbc.api.DbKit;
|
||||||
import net.tccn.dbq.parser.ParseMysql;
|
import net.tccn.dbq.parser.ParseMysql;
|
||||||
|
import net.tccn.meta.MetaService;
|
||||||
import net.tccn.meta.MetaTable;
|
import net.tccn.meta.MetaTable;
|
||||||
import net.tccn.qtask.TaskEntity;
|
import net.tccn.qtask.TaskEntity;
|
||||||
import net.tccn.qtask.TaskKit;
|
import net.tccn.qtask.TaskKit;
|
||||||
import net.tccn.user.User;
|
import net.tccn.user.User;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.redkale.convert.json.JsonConvert;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -25,6 +26,7 @@ import static java.util.Arrays.asList;
|
|||||||
* @author: liangxianyou at 2019/1/20 12:43.
|
* @author: liangxianyou at 2019/1/20 12:43.
|
||||||
*/
|
*/
|
||||||
public class RunTest<T> {
|
public class RunTest<T> {
|
||||||
|
JsonConvert convert = JsonConvert.root();
|
||||||
|
|
||||||
/*public static Task A = new Task("mysql", "select * from user where userid=#(userid)", "查询用户列表", Kv.of("userid", 1));
|
/*public static Task A = new Task("mysql", "select * from user where userid=#(userid)", "查询用户列表", Kv.of("userid", 1));
|
||||||
public static Task B = new Task("method", "User.say", "user调用", Kv.of("name", "张三").set("age", 13));
|
public static Task B = new Task("method", "User.say", "user调用", Kv.of("name", "张三").set("age", 13));
|
||||||
@@ -48,7 +50,11 @@ public class RunTest<T> {
|
|||||||
ParseMysql parser = new ParseMysql();
|
ParseMysql parser = new ParseMysql();
|
||||||
//@Test
|
//@Test
|
||||||
public void parseFBeanTest() {
|
public void parseFBeanTest() {
|
||||||
FBean fBean = new Gson().fromJson("{name:'user_service', filters:[{col:'a.username',type:'like',value:'lxy'}], orders:[{col:a.`id`,desc: -1},{col:a.`deptName`,desc: 1}], limit:{ps:2,pn:10}}", FBean.class);
|
String str = "{name:'user_service', filters:[{col:'a.username',type:'like',value:'lxy'}], orders:[{col:a.`id`,desc: -1},{col:a.`deptName`,desc: 1}], limit:{ps:2,pn:10}}";
|
||||||
|
|
||||||
|
|
||||||
|
//FBean fBean = new Gson().fromJson(str, FBean.class);
|
||||||
|
FBean fBean = convert.convertFrom(FBean.class, str);
|
||||||
|
|
||||||
String[] parse = parser.parse(fBean);
|
String[] parse = parser.parse(fBean);
|
||||||
|
|
||||||
@@ -228,8 +234,27 @@ public class RunTest<T> {
|
|||||||
TaskEntity entity = TaskEntity.dao.findByKey("23074420");
|
TaskEntity entity = TaskEntity.dao.findByKey("23074420");
|
||||||
|
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
System.out.printf("------------------------%n%s%n------------------------%n", new Gson().toJson(TaskKit.taskRun(entity)));
|
System.out.printf("------------------------%n%s%n------------------------%n", convert.convertTo(TaskKit.taskRun(entity)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void dataToFileTest() {
|
||||||
|
|
||||||
|
List<MetaService> metaServices = MetaService.dao.find();
|
||||||
|
|
||||||
|
|
||||||
|
JsonConvert convert = JsonConvert.root();
|
||||||
|
System.out.println(convert.convertTo(metaServices));
|
||||||
|
|
||||||
|
MetaService metaService = new MetaService();
|
||||||
|
|
||||||
|
|
||||||
|
/*try {
|
||||||
|
FileKit.strToFile(gson.toJson(metaServices), file);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user