1、包结构修改
2、dict的bug修改 3、arangodb查询find()默认1000条修改为库里所有数据
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
package net.tccn.service;
|
||||
package net.tccn.base;
|
||||
|
||||
import net.tccn.base.MetaKit;
|
||||
import net.tccn.base.TplKit;
|
||||
import net.tccn.base.X;
|
||||
import org.redkale.convert.json.JsonConvert;
|
||||
import org.redkale.net.http.RestMapping;
|
||||
import org.redkale.service.Service;
|
||||
@@ -1,12 +1,9 @@
|
||||
package net.tccn.servlet;
|
||||
package net.tccn.base;
|
||||
|
||||
import com.arangodb.ArangoDBException;
|
||||
import net.tccn.base.CfgException;
|
||||
import net.tccn.base.JBean;
|
||||
import net.tccn.base.Kv;
|
||||
import net.tccn.base.arango.ArangoSource;
|
||||
import net.tccn.service.UserService;
|
||||
import net.tccn.user.User;
|
||||
import net.tccn.user.UserService;
|
||||
import org.redkale.net.http.HttpRequest;
|
||||
import org.redkale.net.http.HttpResponse;
|
||||
import org.redkale.net.http.HttpServlet;
|
||||
@@ -72,7 +69,7 @@ public class BaseServlet extends HttpServlet {
|
||||
super.execute(request, response);
|
||||
} catch (ArangoDBException e) {
|
||||
logger.log(Level.INFO, "arangodb init!", e);
|
||||
ArangoSource.init();
|
||||
ArangoSource.use();
|
||||
} catch (UnsupportedOperationException e) {
|
||||
e.printStackTrace();
|
||||
response.finish(JBean.by(-1, e.getMessage()));
|
||||
@@ -2,9 +2,9 @@ package net.tccn.base;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.tccn.base.arango.Doc;
|
||||
import net.tccn.dbq.jdbc.api.DbAccount;
|
||||
import net.tccn.dbq.jdbc.api.DbKit;
|
||||
import net.tccn.dbq.table.Field;
|
||||
import net.tccn.base.dbq.jdbc.api.DbAccount;
|
||||
import net.tccn.base.dbq.jdbc.api.DbKit;
|
||||
import net.tccn.base.dbq.table.Field;
|
||||
import net.tccn.dict.Dict;
|
||||
import net.tccn.meta.*;
|
||||
import net.tccn.plat.DbPlat;
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
package net.tccn.base.arango;
|
||||
|
||||
import com.arangodb.*;
|
||||
import com.arangodb.ArangoCollection;
|
||||
import com.arangodb.ArangoDB;
|
||||
import com.arangodb.ArangoDatabase;
|
||||
import com.arangodb.Function;
|
||||
import com.arangodb.entity.DocumentCreateEntity;
|
||||
import com.arangodb.entity.DocumentDeleteEntity;
|
||||
import com.arangodb.entity.MultiDocumentEntity;
|
||||
import net.tccn.base.PropKit;
|
||||
import net.tccn.base.X;
|
||||
|
||||
import javax.persistence.Table;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -16,6 +21,7 @@ import static java.util.Arrays.asList;
|
||||
|
||||
/**
|
||||
* 管理 数据源连接对象
|
||||
*
|
||||
* @author: liangxianyou at 2018/12/15 11:35.
|
||||
*/
|
||||
public class ArangoSource {
|
||||
@@ -24,38 +30,46 @@ public class ArangoSource {
|
||||
private ArangoDB arangoDb;
|
||||
|
||||
private static Map<String, ArangoSource> sources = new HashMap();
|
||||
static {
|
||||
init();
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
sources.put("main", new ArangoSource(new ArangoDB.Builder().host("120.24.230.60", 8529).user("root").password("abc123").build()));
|
||||
sources.put("abc", new ArangoSource(new ArangoDB.Builder().host("192.168.199.135", 8529).user("root").password("root").build()));
|
||||
}
|
||||
|
||||
public ArangoSource(ArangoDB arangoDb) {
|
||||
private ArangoSource(ArangoDB arangoDb) {
|
||||
this.arangoDb = arangoDb;
|
||||
}
|
||||
|
||||
public static ArangoSource use() {
|
||||
return use("main");
|
||||
}
|
||||
|
||||
public static ArangoSource use(String unit) {
|
||||
if (unit == null || unit.isEmpty()) {
|
||||
unit = "main";
|
||||
if (unit == null || unit.isEmpty() || "main".equals(unit)) {
|
||||
unit = "";
|
||||
} else {
|
||||
unit = "." + unit;
|
||||
}
|
||||
return sources.get(unit);
|
||||
|
||||
ArangoSource source = sources.get(unit);
|
||||
if (source == null) {
|
||||
String host = PropKit.getProperty("arango.host" + unit);
|
||||
int port = Integer.parseInt(PropKit.getProperty("arango.port" + unit, "8529"));
|
||||
String user = PropKit.getProperty("arango.user" + unit);
|
||||
String password = PropKit.getProperty("arango.passwd" + unit);
|
||||
|
||||
source = new ArangoSource(new ArangoDB.Builder().host(host, port).user(user).password(password).build());
|
||||
}
|
||||
return source;
|
||||
}
|
||||
|
||||
public ArangoDB arangoDB() {
|
||||
return arangoDb;
|
||||
}
|
||||
|
||||
public ArangoDatabase db(String db) {
|
||||
return arangoDb.db(db);
|
||||
}
|
||||
|
||||
public <T extends Doc> ArangoCollection collection(Doc<T> doc) {
|
||||
return collection(doc.getClass());
|
||||
}
|
||||
|
||||
public <T extends Doc> ArangoCollection collection(Class<T> type) {
|
||||
Table table = type.getAnnotation(Table.class);
|
||||
//createDb(table.catalog());
|
||||
@@ -70,6 +84,7 @@ public class ArangoSource {
|
||||
logger.log(Level.INFO, "arango database exists");
|
||||
return true;
|
||||
}
|
||||
|
||||
public <T extends Doc> ArangoCollection createDocument(Doc<T> doc) {
|
||||
Class<? extends Doc> type = doc.getClass();
|
||||
Table table = type.getAnnotation(Table.class);
|
||||
@@ -92,92 +107,9 @@ public class ArangoSource {
|
||||
return s.substring(0, 1).toUpperCase() + s.substring(1);
|
||||
};
|
||||
|
||||
private static Map<Class, Class[]> clazzMap = new HashMap<>();
|
||||
static {
|
||||
clazzMap.put(ArrayList.class, new Class[]{List.class, ArrayList.class, String.class});
|
||||
clazzMap.put(HashMap.class, new Class[]{Map.class, HashMap.class, String.class});
|
||||
clazzMap.put(Long.class, new Class[]{Long.class, Integer.class, long.class, int.class, short.class, String.class});
|
||||
clazzMap.put(String.class, new Class[]{String.class});
|
||||
}
|
||||
/**
|
||||
* 还原 Doc对象
|
||||
* @param map
|
||||
* @param type
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public <T extends Doc> T toDoc1(Map<String, Object> map, Class<T> type) {
|
||||
try {
|
||||
Doc doc = type.newInstance();
|
||||
map.forEach((k, v) -> {
|
||||
|
||||
String methodName = "set" + upFirst.apply(k);
|
||||
Method method = null;
|
||||
Class[] clazzs = clazzMap.get(v == null ? null : v.getClass());
|
||||
if (clazzs == null) {
|
||||
doc.set(k, v);
|
||||
} else {
|
||||
for (Class clazz : clazzs) {
|
||||
try {
|
||||
method = type.getDeclaredMethod(methodName, clazz);
|
||||
} catch (NoSuchMethodException e) {
|
||||
}
|
||||
if (method != null) {
|
||||
try {
|
||||
if (v.getClass() == Long.class && clazz != Long.class) {//多种数值类型的处理
|
||||
Object _v;
|
||||
switch (clazz.getSimpleName()) {
|
||||
case "int":
|
||||
case "Integer": _v = (int)((long) v); break;
|
||||
case "short":
|
||||
case "Short": _v = (short)((long) v); break;
|
||||
default: _v = v;
|
||||
}
|
||||
System.out.println(clazz.getSimpleName());
|
||||
method.invoke(doc, _v);
|
||||
} else {
|
||||
method.invoke(doc, v);
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
doc.set(k, v);
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
doc.set(k, v);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (method == null) {
|
||||
doc.set(k, v);
|
||||
}
|
||||
});
|
||||
|
||||
return (T) doc;
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Predicate isEmpty = (x) -> {
|
||||
if (x == null)
|
||||
return true;
|
||||
if (x instanceof List)
|
||||
return ((List) x).isEmpty();
|
||||
if (x instanceof String)
|
||||
return ((String) x).isEmpty();
|
||||
if (x instanceof Map)
|
||||
return ((Map) x).isEmpty();
|
||||
if (x instanceof Collection)
|
||||
return ((Collection) x).isEmpty();
|
||||
return false;
|
||||
};
|
||||
/**
|
||||
* Doc 转为查询对象
|
||||
*
|
||||
* @param t
|
||||
* @param <T>
|
||||
* @return
|
||||
@@ -205,7 +137,7 @@ public class ArangoSource {
|
||||
private Function<Doc, StringBuilder> orderBuilder = (t) -> {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
Map<String, Integer> order = t.getOrder();
|
||||
if (isEmpty.test(order)) {
|
||||
if (X.isEmpty(order)) {
|
||||
return buf.append(" sort d._key desc");
|
||||
}
|
||||
buf.append(" sort ");
|
||||
@@ -219,7 +151,7 @@ public class ArangoSource {
|
||||
private Function<Doc, StringBuilder> returnBuilder = (t) -> {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
|
||||
if (isEmpty.test(t.get_Shows())) {
|
||||
if (X.isEmpty(t.get_Shows())) {
|
||||
return buf.append(" return d");
|
||||
}
|
||||
|
||||
@@ -239,6 +171,7 @@ public class ArangoSource {
|
||||
//logger.log(Level.INFO, buf.toString());
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public <T extends Doc> String parseAql(T t, int offset, int ps) {
|
||||
if (offset < 0) offset = 0;
|
||||
if (ps <= 0) ps = 1000;
|
||||
@@ -251,6 +184,7 @@ public class ArangoSource {
|
||||
//logger.log(Level.INFO, buf.toString());
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
//ok
|
||||
public <T extends Doc> T save(T doc) {
|
||||
@@ -267,7 +201,7 @@ public class ArangoSource {
|
||||
|
||||
//ok
|
||||
public <T extends Doc> T getDoc(Object key, Class<T> type) {
|
||||
return collection(type).getDocument(String.valueOf(key), type);
|
||||
return collection(type).getDocument(String.valueOf(key), type);
|
||||
}
|
||||
|
||||
//ok
|
||||
@@ -276,7 +210,7 @@ public class ArangoSource {
|
||||
}
|
||||
|
||||
//ok
|
||||
public <T extends Doc> MultiDocumentEntity<DocumentDeleteEntity<Void>> deleteAll(Doc<T> ... docs) {
|
||||
public <T extends Doc> MultiDocumentEntity<DocumentDeleteEntity<Void>> deleteAll(Doc<T>... docs) {
|
||||
return collection(docs[0]).deleteDocuments(asList(docs));
|
||||
}
|
||||
|
||||
|
||||
@@ -43,12 +43,12 @@ public abstract class Doc<T extends Doc> {
|
||||
this._key = key;
|
||||
}
|
||||
|
||||
public Doc<T> set(String k, Object v) {
|
||||
protected Doc<T> set(String k, Object v) {
|
||||
attr.put(k, v);
|
||||
return this;
|
||||
}
|
||||
|
||||
public <V> V get(String k) {
|
||||
protected <V> V get(String k) {
|
||||
return (V)attr.get(k);
|
||||
}
|
||||
|
||||
@@ -212,16 +212,17 @@ public abstract class Doc<T extends Doc> {
|
||||
return findFirst(arangoSource.parseAql(t, 0, 1), (Class<T>) t.getClass());
|
||||
}
|
||||
public List<T> find() {
|
||||
return find((T) this, 0, 1000);
|
||||
int count = count(this);
|
||||
return find((T) this, 0, count);
|
||||
}
|
||||
public List<T> find(T t) {
|
||||
return find(t, 0, 1000);
|
||||
}
|
||||
public <T extends Doc> List<T> find(T t, int offset, int pn) {
|
||||
public <T extends Doc> List<T> find(T t, int offset, int ps) {
|
||||
if (t == null) {
|
||||
t = (T) this;
|
||||
}
|
||||
return find(arangoSource.parseAql(t, offset, pn), (Class<T>)this.getClass());
|
||||
return find(arangoSource.parseAql(t, offset, ps), (Class<T>)this.getClass());
|
||||
}
|
||||
|
||||
public <T> List<T> find(String aql, Class<T> clazz) {
|
||||
@@ -230,7 +231,7 @@ public abstract class Doc<T extends Doc> {
|
||||
} catch (ArangoDBException e) {
|
||||
System.out.println(aql);
|
||||
e.printStackTrace();
|
||||
ArangoSource.init();
|
||||
ArangoSource.use();
|
||||
}
|
||||
return db.query(aql, clazz).asListRemaining();
|
||||
}
|
||||
@@ -240,19 +241,19 @@ public abstract class Doc<T extends Doc> {
|
||||
} catch (ArangoDBException e) {
|
||||
System.out.println(aql);
|
||||
e.printStackTrace();
|
||||
ArangoSource.init();
|
||||
ArangoSource.use();
|
||||
}
|
||||
return db.query(aql, clazz).first();
|
||||
}
|
||||
|
||||
public long count() {
|
||||
public int count() {
|
||||
return count(this);
|
||||
}
|
||||
public <T extends Doc> long count(T t) {
|
||||
public <T extends Doc> int count(T t) {
|
||||
if (t == null) {
|
||||
t = (T) this;
|
||||
}
|
||||
return db.query(arangoSource.parseAqlCount(t), long.class).first();
|
||||
return db.query(arangoSource.parseAqlCount(t), int.class).first();
|
||||
}
|
||||
//ok
|
||||
public <T extends Doc> T findByKey(Object key) {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package net.tccn.dbq;
|
||||
package net.tccn.base.dbq;
|
||||
|
||||
import net.tccn.base.MetaKit;
|
||||
import net.tccn.base.PageBean;
|
||||
import net.tccn.dbq.fbean.FBean;
|
||||
import net.tccn.dbq.jdbc.api.DbKit;
|
||||
import net.tccn.dbq.parser.ParseMysql;
|
||||
import net.tccn.base.dbq.fbean.FBean;
|
||||
import net.tccn.base.dbq.jdbc.api.DbKit;
|
||||
import net.tccn.base.dbq.parser.ParseMysql;
|
||||
import net.tccn.meta.MetaService;
|
||||
import net.tccn.meta.MetaTable;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.tccn.dbq.fbean;
|
||||
package net.tccn.base.dbq.fbean;
|
||||
|
||||
/**
|
||||
* Created by liangxianyou at 2018/12/14 15:34.
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.tccn.dbq.fbean;
|
||||
package net.tccn.base.dbq.fbean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.tccn.dbq.fbean;
|
||||
package net.tccn.base.dbq.fbean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.tccn.dbq.fbean;
|
||||
package net.tccn.base.dbq.fbean;
|
||||
|
||||
import net.tccn.base.Kv;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.tccn.dbq.fbean;
|
||||
package net.tccn.base.dbq.fbean;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.tccn.dbq.fbean;
|
||||
package net.tccn.base.dbq.fbean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.tccn.dbq.jdbc.api;
|
||||
package net.tccn.base.dbq.jdbc.api;
|
||||
|
||||
import lombok.Data;
|
||||
import net.tccn.base.arango.Doc;
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.tccn.dbq.jdbc.api;
|
||||
package net.tccn.base.dbq.jdbc.api;
|
||||
|
||||
import net.tccn.base.X;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.tccn.dbq.jdbc.api;
|
||||
package net.tccn.base.dbq.jdbc.api;
|
||||
|
||||
import net.tccn.base.IService;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.tccn.dbq.jdbc.api;
|
||||
package net.tccn.base.dbq.jdbc.api;
|
||||
|
||||
import net.tccn.base.CfgException;
|
||||
import net.tccn.base.Kv;
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.tccn.dbq.parser;
|
||||
package net.tccn.base.dbq.parser;
|
||||
|
||||
import net.tccn.dbq.fbean.FBean;
|
||||
import net.tccn.base.dbq.fbean.FBean;
|
||||
|
||||
/**
|
||||
* Created by liangxianyou at 2018/12/24 15:49.
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.tccn.dbq.parser;
|
||||
package net.tccn.base.dbq.parser;
|
||||
|
||||
import net.tccn.dbq.fbean.FBean;
|
||||
import net.tccn.base.dbq.fbean.FBean;
|
||||
|
||||
/**
|
||||
* Created by liangxianyou at 2018/12/24 15:49.
|
||||
@@ -1,7 +1,7 @@
|
||||
package net.tccn.dbq.parser;
|
||||
package net.tccn.base.dbq.parser;
|
||||
|
||||
import net.tccn.base.*;
|
||||
import net.tccn.dbq.fbean.*;
|
||||
import net.tccn.base.dbq.fbean.*;
|
||||
import net.tccn.meta.MetaLink;
|
||||
import net.tccn.meta.MetaService;
|
||||
import net.tccn.meta.MetaTable;
|
||||
@@ -20,20 +20,6 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
public class ParseMysql implements Parser {
|
||||
|
||||
private Predicate isEmpty = (x) -> {
|
||||
if (x == null)
|
||||
return true;
|
||||
if (x instanceof List)
|
||||
return ((List) x).isEmpty();
|
||||
if (x instanceof String)
|
||||
return ((String) x).isEmpty();
|
||||
if (x instanceof Map)
|
||||
return ((Map) x).isEmpty();
|
||||
if (x instanceof Collection)
|
||||
return ((Collection) x).isEmpty();
|
||||
return false;
|
||||
};
|
||||
|
||||
Predicate<Kv<String, MetaTable>> sameDbFun = (kv) -> {
|
||||
String dbPlatId = null;
|
||||
for (MetaTable metaTable : kv.values()) {
|
||||
@@ -78,20 +64,20 @@ public class ParseMysql implements Parser {
|
||||
if (sameDbFun.test(tables) || true) {
|
||||
// where 1=1 and xx=xx
|
||||
StringBuffer bufWhere = new StringBuffer();
|
||||
if (!isEmpty.test(filters)) {
|
||||
if (!X.isEmpty(filters)) {
|
||||
bufWhere.append(Filter.filter(filters, DbType.MYSQL));
|
||||
}
|
||||
|
||||
//select a.x, b.y, c.z
|
||||
StringBuffer bufSelect = new StringBuffer();
|
||||
bufSelect.append("select ");
|
||||
if ("export".equals(fBean.getType()) && !isEmpty.test(exports)) {
|
||||
if ("export".equals(fBean.getType()) && !X.isEmpty(exports)) {
|
||||
exports.forEach(x -> {
|
||||
bufSelect.append(x.get("col")).append(" as ").append("'").append(x.get("col")).append("',");
|
||||
});
|
||||
bufSelect.deleteCharAt(bufSelect.length() - 1);
|
||||
}
|
||||
else if ("list".equals(fBean.getType()) && !isEmpty.test(shows)) {
|
||||
else if ("list".equals(fBean.getType()) && !X.isEmpty(shows)) {
|
||||
shows.forEach(x -> {
|
||||
bufSelect.append(x.get("col")).append(" as ").append("'").append(x.get("col")).append("',");
|
||||
});
|
||||
@@ -104,7 +90,7 @@ public class ParseMysql implements Parser {
|
||||
StringBuilder bufFrom = new StringBuilder();
|
||||
bufFrom.append(" from ").append(metaTable.getCatalog()).append(".`").append(metaTable.getName()).append("` ").append(metaTable.getAlias());
|
||||
//left join
|
||||
if (!isEmpty.test(links)) {
|
||||
if (!X.isEmpty(links)) {
|
||||
links.forEach(x -> {
|
||||
MetaTable rightTable = tables.get(metaTable.getAlias().equals(x.getTables()[0]) ? x.getTables()[1] : x.getTables()[0]);
|
||||
if (rightTable != null) {
|
||||
@@ -122,7 +108,7 @@ public class ParseMysql implements Parser {
|
||||
|
||||
StringBuffer bufOth = new StringBuffer();
|
||||
//order by
|
||||
if (!isEmpty.test(orders)) {
|
||||
if (!X.isEmpty(orders)) {
|
||||
bufOth.append(" ").append(Order.order(orders, DbType.MYSQL));
|
||||
}
|
||||
//limit
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.tccn.dbq.parser;
|
||||
package net.tccn.base.dbq.parser;
|
||||
|
||||
import net.tccn.dbq.fbean.FBean;
|
||||
import net.tccn.base.dbq.fbean.FBean;
|
||||
|
||||
/**
|
||||
* Db 执行解释层
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.tccn.dbq.qtask;
|
||||
package net.tccn.base.dbq.qtask;
|
||||
|
||||
import lombok.Data;
|
||||
import net.tccn.base.arango.Doc;
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.tccn.dbq.table;
|
||||
package net.tccn.base.dbq.table;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.tccn.dbq.table;
|
||||
package net.tccn.base.dbq.table;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package net.tccn.dbq.table;
|
||||
package net.tccn.base.dbq.table;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
@@ -11,9 +11,6 @@ import java.util.*;
|
||||
* @author: liangxianyou
|
||||
*/
|
||||
public final class DictKit {
|
||||
private static String dcate = "db";
|
||||
private static String dataPath;
|
||||
|
||||
private static Map<String, DictKit> kits = new HashMap<>();
|
||||
private String platToken;
|
||||
private Map<String, List<Dict>> dicts;
|
||||
@@ -32,6 +29,10 @@ public final class DictKit {
|
||||
return dictKit;
|
||||
}
|
||||
|
||||
public synchronized void reload() {
|
||||
this.dicts = MetaKit.getDictData(platToken);
|
||||
}
|
||||
|
||||
// 初始化字典,不同模式下,数据来源不同
|
||||
|
||||
private void stop() {
|
||||
@@ -144,7 +145,7 @@ public final class DictKit {
|
||||
Objects.requireNonNull(label, "label 不能为空");
|
||||
|
||||
List<Dict> dicts = getDicts(code);
|
||||
Optional<Dict> any = dicts.stream().filter(x -> label.equals(x.get("label"))).findAny();
|
||||
Optional<Dict> any = dicts.stream().filter(x -> label.equals(x.getLabel())).findAny();
|
||||
return any.isPresent() ? any.get().getValue() : "";
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package net.tccn.service;
|
||||
package net.tccn.dict;
|
||||
|
||||
import net.tccn.base.BaseService;
|
||||
import net.tccn.base.JBean;
|
||||
import net.tccn.dict.Dict;
|
||||
import net.tccn.dict.DictKit;
|
||||
import org.redkale.net.http.RestMapping;
|
||||
import org.redkale.net.http.RestParam;
|
||||
import org.redkale.net.http.RestService;
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.tccn.servlet;
|
||||
package net.tccn.file;
|
||||
|
||||
import net.tccn.base.BaseServlet;
|
||||
import net.tccn.base.JBean;
|
||||
import net.tccn.base.Kv;
|
||||
import org.redkale.net.http.*;
|
||||
@@ -1,10 +1,7 @@
|
||||
package net.tccn.service;
|
||||
package net.tccn.file;
|
||||
|
||||
import net.tccn.base.ExcelKit;
|
||||
import net.tccn.base.JBean;
|
||||
import net.tccn.base.Kv;
|
||||
import net.tccn.base.MetaKit;
|
||||
import net.tccn.dbq.table.Field;
|
||||
import net.tccn.base.*;
|
||||
import net.tccn.base.dbq.table.Field;
|
||||
import net.tccn.meta.MetaTable;
|
||||
import net.tccn.plat.SysPlat;
|
||||
import org.redkale.net.http.RestMapping;
|
||||
@@ -2,7 +2,7 @@ package net.tccn.meta;
|
||||
|
||||
import lombok.Data;
|
||||
import net.tccn.base.arango.Doc;
|
||||
import net.tccn.dbq.table.Field;
|
||||
import net.tccn.base.dbq.table.Field;
|
||||
|
||||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
@@ -30,7 +30,7 @@ public class MetaTable extends Doc<MetaTable> implements Serializable {
|
||||
|
||||
private Integer hv;//临时
|
||||
// ------------------------------------------------
|
||||
public static MetaTable toAs(net.tccn.dbq.table.Table table) {
|
||||
public static MetaTable toAs(net.tccn.base.dbq.table.Table table) {
|
||||
List<Field> fields = table.getColumns().stream().map(Field::toAs).collect(Collectors.toList());
|
||||
|
||||
MetaTable _bean = new MetaTable();
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package net.tccn.service;
|
||||
package net.tccn.meta;
|
||||
|
||||
import net.tccn.base.BaseService;
|
||||
import net.tccn.base.JBean;
|
||||
import net.tccn.base.Kv;
|
||||
import net.tccn.base.MetaKit;
|
||||
import net.tccn.dbq.table.Field;
|
||||
import net.tccn.meta.*;
|
||||
import net.tccn.base.dbq.table.Field;
|
||||
import net.tccn.plat.SysPlat;
|
||||
import org.redkale.net.http.RestMapping;
|
||||
import org.redkale.net.http.RestParam;
|
||||
@@ -1,15 +1,14 @@
|
||||
package net.tccn.service;
|
||||
package net.tccn.open;
|
||||
|
||||
import net.tccn.base.*;
|
||||
import net.tccn.dbq.DbExecutors;
|
||||
import net.tccn.dbq.fbean.FBean;
|
||||
import net.tccn.base.dbq.fbean.FBean;
|
||||
import net.tccn.base.dbq.*;
|
||||
import net.tccn.dict.DictKit;
|
||||
import net.tccn.meta.MetaService;
|
||||
import org.redkale.net.http.HttpScope;
|
||||
import org.redkale.net.http.RestMapping;
|
||||
import org.redkale.net.http.RestParam;
|
||||
import org.redkale.net.http.RestService;
|
||||
import org.redkale.util.Comment;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -1,14 +0,0 @@
|
||||
package net.tccn.oth;
|
||||
|
||||
import net.tccn.base.Kv;
|
||||
|
||||
/**
|
||||
* @author: liangxianyou
|
||||
*/
|
||||
public class QtaskTest {
|
||||
|
||||
public Kv abx(Kv kv) {
|
||||
|
||||
return Kv.of("hello", "world").putAll(kv);
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
package net.tccn.service;
|
||||
package net.tccn.plat;
|
||||
|
||||
import net.tccn.base.BaseService;
|
||||
import net.tccn.base.JBean;
|
||||
import net.tccn.base.MetaKit;
|
||||
import net.tccn.base.PageBean;
|
||||
import net.tccn.dbq.jdbc.api.DbAccount;
|
||||
import net.tccn.plat.DbPlat;
|
||||
import net.tccn.plat.SysPlat;
|
||||
import net.tccn.base.dbq.jdbc.api.DbAccount;
|
||||
import org.redkale.net.http.RestMapping;
|
||||
import org.redkale.net.http.RestService;
|
||||
import org.redkale.source.Flipper;
|
||||
@@ -1,12 +1,13 @@
|
||||
package net.tccn.service;
|
||||
package net.tccn.plat;
|
||||
|
||||
import net.tccn.base.BaseService;
|
||||
import net.tccn.base.JBean;
|
||||
import net.tccn.base.Kv;
|
||||
import net.tccn.base.MetaKit;
|
||||
import net.tccn.dbq.jdbc.api.DbAccount;
|
||||
import net.tccn.dbq.jdbc.api.DbKit;
|
||||
import net.tccn.dbq.table.Column;
|
||||
import net.tccn.dbq.table.Table;
|
||||
import net.tccn.base.dbq.jdbc.api.DbAccount;
|
||||
import net.tccn.base.dbq.jdbc.api.DbKit;
|
||||
import net.tccn.base.dbq.table.Column;
|
||||
import net.tccn.base.dbq.table.Table;
|
||||
import net.tccn.meta.MetaTable;
|
||||
import org.redkale.net.http.RestMapping;
|
||||
import org.redkale.net.http.RestService;
|
||||
@@ -1,9 +1,11 @@
|
||||
package net.tccn.service;
|
||||
package net.tccn.plat;
|
||||
|
||||
import net.tccn.base.BaseService;
|
||||
import net.tccn.base.JBean;
|
||||
import net.tccn.base.Kv;
|
||||
import net.tccn.base.MetaKit;
|
||||
import net.tccn.dbq.table.Table;
|
||||
import net.tccn.base.dbq.table.Table;
|
||||
import net.tccn.file._FileService;
|
||||
import net.tccn.meta.MetaTable;
|
||||
import org.redkale.net.http.RestMapping;
|
||||
import org.redkale.net.http.RestParam;
|
||||
@@ -1,8 +1,8 @@
|
||||
package net.tccn.service;
|
||||
package net.tccn.qtask;
|
||||
|
||||
import net.tccn.base.BaseService;
|
||||
import net.tccn.base.JBean;
|
||||
import net.tccn.base.Kv;
|
||||
import net.tccn.qtask.TaskKit;
|
||||
import org.redkale.net.http.RestMapping;
|
||||
import org.redkale.net.http.RestParam;
|
||||
import org.redkale.net.http.RestService;
|
||||
@@ -2,7 +2,7 @@ package net.tccn.qtask;
|
||||
|
||||
import lombok.Data;
|
||||
import net.tccn.base.Kv;
|
||||
import net.tccn.dbq.jdbc.api.DbAccount;
|
||||
import net.tccn.base.dbq.jdbc.api.DbAccount;
|
||||
|
||||
/**
|
||||
* |- dbp: 调用谁, 参数,
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
package net.tccn.service;
|
||||
package net.tccn.qtask;
|
||||
|
||||
import net.tccn.base.BaseService;
|
||||
import net.tccn.base.JBean;
|
||||
import net.tccn.base.MetaKit;
|
||||
import net.tccn.base.PageBean;
|
||||
import net.tccn.qtask.TaskEntity;
|
||||
import net.tccn.qtask.TaskKit;
|
||||
import org.redkale.net.http.RestParam;
|
||||
import org.redkale.net.http.RestService;
|
||||
import org.redkale.source.Flipper;
|
||||
import org.redkale.util.Comment;
|
||||
|
||||
@RestService(automapping = true)
|
||||
public class _QtaskService extends BaseService{
|
||||
public class _QtaskService extends BaseService {
|
||||
|
||||
@Comment("qtask列表")
|
||||
public JBean list(TaskEntity task, Flipper flipper, @RestParam(name = "platToken") String token) {
|
||||
@@ -4,7 +4,7 @@ import com.jfinal.plugin.activerecord.dialect.MysqlDialect;
|
||||
import com.jfinal.template.Engine;
|
||||
import com.jfinal.template.Template;
|
||||
import net.tccn.base.MetaKit;
|
||||
import net.tccn.dbq.jdbc.api.DbKit;
|
||||
import net.tccn.base.dbq.jdbc.api.DbKit;
|
||||
import net.tccn.qtask.QTask;
|
||||
import net.tccn.qtask.Task;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package net.tccn.service;
|
||||
package net.tccn.user;
|
||||
|
||||
import net.tccn.base.BaseService;
|
||||
import net.tccn.base.JBean;
|
||||
import net.tccn.base.MetaKit;
|
||||
import net.tccn.user.User;
|
||||
import org.redkale.net.http.RestMapping;
|
||||
import org.redkale.net.http.RestService;
|
||||
import org.redkale.net.http.RestSessionid;
|
||||
Reference in New Issue
Block a user