修改:1、arangodb -> mysql,去除arangodb

2、部分字段逻辑重构
This commit is contained in:
2024-04-01 15:53:48 +08:00
parent 81e1a59e65
commit 9973ad18ca
59 changed files with 926 additions and 660 deletions

View File

@@ -6,8 +6,8 @@ import net.tccn.base.PageBean;
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;
import net.tccn.meta.MService;
import net.tccn.meta.MTable;
import java.util.List;
import java.util.Map;
@@ -25,9 +25,9 @@ public class DbExecutors {
String[] sqls = PARSER.parseList(fBean);
//当前的业务 => 获取主表 信息 => 数据源信息 => 数据源对象 => 创建数据工具对象 => 查询数据
MetaService metaService = MetaKit.getMetaService(fBean.getName(), fBean.getPlatToken());
MetaTable mainTable = MetaKit.getMetaTableByAlias(metaService.getTable());
DbKit dbKit = MetaKit.getDbKit(mainTable.getDbPlatId(), mainTable.getCatalog());
MService metaService = MetaKit.getMetaService(fBean.getName(), fBean.getPlattoken());
MTable mainTable = MetaKit.getMetaTableByAlias(metaService.getTablealias());
DbKit dbKit = MetaKit.getDbKit(mainTable.getDbid(), mainTable.getCatalog());
System.out.printf("----------------%n countSql:%s%n findSql:%s%n----------------%n", sqls[0], sqls[1]);
CompletableFuture<Integer> countFuture = CompletableFuture.supplyAsync(() -> dbKit.findColumn(sqls[0], int.class));
@@ -37,7 +37,7 @@ public class DbExecutors {
Integer total = countFuture.get();
rows.forEach(m -> {
m.forEach((k,v) -> {
m.forEach((k, v) -> {
/*if ("[B".equals(v.getClass().getName())) {
try {
//System.out.println(k + " : " + new String((byte[]) v, "UTF-8"));
@@ -47,7 +47,7 @@ public class DbExecutors {
}
}*/
// 避免前端 解析丢失精度
if (v instanceof Long && (Long)v > 9007199254740991L) {
if (v instanceof Long && (Long) v > 9007199254740991L) {
m.put(k, Kv.toAs(v, String.class));
}
});
@@ -55,18 +55,18 @@ public class DbExecutors {
return PageBean.by(rows, total);
}
public static void del(String name, Map data, String token) {
MetaService metaService = MetaKit.getMetaService(name, token);
MetaTable mainTable = MetaKit.getMetaTableByAlias(metaService.getTable());
DbKit dbKit = MetaKit.getDbKit(mainTable.getDbPlatId(), mainTable.getCatalog());
/*public static void del(String name, Map data, String token) {
MService metaService = MetaKit.getMetaService(name, token);
MTable mainTable = MetaKit.getMetaTableByAlias(metaService.getTablealias());
DbKit dbKit = MetaKit.getDbKit(mainTable.getDbid(), mainTable.getCatalog());
String delSql = PARSER.parseDel(name, data, token);
dbKit.exetute(delSql);
}
}*/
public static void save(String name, Map data, String token) {
MetaTable mainTable = MetaKit.getMainTable(name, token);
DbKit dbKit = MetaKit.getDbKit(mainTable.getDbPlatId(), mainTable.getCatalog());
MTable mainTable = MetaKit.getMainTable(name, token);
DbKit dbKit = MetaKit.getDbKit(mainTable.getDbid(), mainTable.getCatalog());
String sql = PARSER.parseSave(name, data, token);
dbKit.exetute(sql);