|
|
|
@ -30,14 +30,30 @@ public class TestDataSet {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取表字段信息
|
|
|
|
|
*
|
|
|
|
|
* @param table_name 表名
|
|
|
|
|
* @return 表的信息
|
|
|
|
|
*/
|
|
|
|
|
public static List<Record> getColumns(String table_name) {
|
|
|
|
|
String sql = "desc `"+table_name+"`";
|
|
|
|
|
String sql = "desc `" + table_name + "`";
|
|
|
|
|
return Db.find(sql);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 将数据集填充到数据库表中,用于配置此数据集让谁来维护
|
|
|
|
|
* @param table_name 表名
|
|
|
|
|
* @param dataset_name 数据集名
|
|
|
|
|
*/
|
|
|
|
|
public static void addDataSet(String table_name, String dataset_name) {
|
|
|
|
|
String sql = "select count(1) from t_dp_dataset where table_name=?";
|
|
|
|
|
if (Db.queryInt(sql, table_name) == 0) {
|
|
|
|
|
Record record = new Record();
|
|
|
|
|
record.set("table_name", table_name);
|
|
|
|
|
record.set("dataset_name", dataset_name);
|
|
|
|
|
Db.save("t_dp_dataset", "id", record);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
//加载配置文件
|
|
|
|
|
String configFile = "application_dataease.yaml";
|
|
|
|
@ -84,11 +100,13 @@ public class TestDataSet {
|
|
|
|
|
List<Record> columns = getColumns(table_name);
|
|
|
|
|
|
|
|
|
|
System.out.println(dataset_name + " " + table_name);
|
|
|
|
|
List<String> cols=new ArrayList<>();
|
|
|
|
|
List<String> cols = new ArrayList<>();
|
|
|
|
|
for (Record column : columns) {
|
|
|
|
|
cols.add(column.getStr("Field"));
|
|
|
|
|
}
|
|
|
|
|
System.out.println(cols);
|
|
|
|
|
//将这些数据集扫描到表中,然后标识这个数据集由谁来维护
|
|
|
|
|
addDataSet(table_name, dataset_name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|