This commit is contained in:
2019-04-12 01:00:32 +08:00
parent 14795814e3
commit cf63a3d072
8 changed files with 44 additions and 172 deletions

View File

@@ -37,7 +37,7 @@ public class _DbService extends BaseService {
}
@RestMapping(name = "table_list", comment = "数据库表列表")
public List<Table> tableList(DbAccount dbAccount, String dbPlatId, String[] catalogs) {
public List<Table> tableList(String dbPlatId, String[] catalogs) {
DbKit dbKit = MetaKit.getDbKit(dbPlatId);
@@ -56,8 +56,7 @@ public class _DbService extends BaseService {
}
@RestMapping(name = "table_info", comment = "数据库表详情")
public JBean tableInfo(DbAccount dbAccount,
String dbPlatId, String catalog, String tableName) {
public JBean tableInfo(String dbPlatId, String catalog, String tableName) {
JBean jBean = new JBean();
DbKit dbKit = MetaKit.getDbKit(dbPlatId);

View File

@@ -2,6 +2,7 @@ package net.tccn.meta;
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.table.Table;
import net.tccn.service.BaseService;
@@ -38,7 +39,7 @@ public class _TableService extends BaseService {
String filePath,
//mysql {数据库连接账号、数据源id、数据库database数组}
DbAccount dbAccount, String dbPlatId, String[] catalogs,
String dbPlatId, String[] catalogs,
@RestParam(name = "platToken") String token) {
JBean jBean = new JBean();
@@ -47,7 +48,7 @@ public class _TableService extends BaseService {
jBean.setBody(fileService.data(filePath, token));
} else if ("mysql".equals(cate)){
List<Table> list = dbService.tableList(dbAccount, dbPlatId, catalogs);
List<Table> list = dbService.tableList(dbPlatId, catalogs);
String[] tableArr = list.stream().map(Table::getName).toArray(String[]::new);
CompletableFuture<List<String>> hvFuture = tableExist(tableArr, token);
@@ -100,7 +101,8 @@ public class _TableService extends BaseService {
MetaTable metaTable = MetaTable.toAs(t);
metaTable.setCatalog(catalog);
metaTable.setDbPlatId(dbPlatId);
metaTable.setAlias("");//todo: 表别名
metaTable.setAlias(MetaKit.nextAlias());//todo: 表别名
metaTable.setSysPlatId(platId(token));
//保存数据到元数据表
metaTable.save();