|
|
|
@ -134,18 +134,36 @@ public class DatasourceOperation {
|
|
|
|
|
return data.getString("data"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 在指定的分组下创建 一个增量更新的数据源表 |
|
|
|
|
* @param tableName 数据源表名 |
|
|
|
|
* @param groupId 分组Id |
|
|
|
|
* @return 数据源表Id |
|
|
|
|
* @throws Exception 操作失败则抛出此异常 |
|
|
|
|
*/ |
|
|
|
|
public String createTableIncreased(String tableName, String groupId) throws Exception { |
|
|
|
|
JSONObject body = new JSONObject(); |
|
|
|
|
body.put("tableName", tableName); |
|
|
|
|
body.put("groupId", groupId); |
|
|
|
|
body.put("increase", true); |
|
|
|
|
HttpEntity entity = new StringEntity(body.toString(), StandardCharsets.UTF_8); |
|
|
|
|
String res = HttpKits.post(String.format("%s/api/v1/datasource/table/create", ProjectConstants.BASE_URI), headers(), entity); |
|
|
|
|
JSONObject data = new JSONObject(res); |
|
|
|
|
return data.getString("data"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 修改已有的数据源表的名字 |
|
|
|
|
* @param tableId 数据源表Id |
|
|
|
|
* @param newTableName 新的数据源表名字 |
|
|
|
|
* @param replaceOldData 是否后续的数据是替换原数据的,true表示替换原数据,false表示在原数据之后追加 |
|
|
|
|
* @param replaceOldData 是否后续的数据是替换原数据的,true表示在原数据之后追加,false表示替换原数据 |
|
|
|
|
* @throws Exception 操作失败则抛出此异常 |
|
|
|
|
*/ |
|
|
|
|
public void modifyTable(String tableId, String newTableName, boolean replaceOldData) throws Exception { |
|
|
|
|
JSONObject body = new JSONObject(); |
|
|
|
|
body.put("tableId", tableId); |
|
|
|
|
body.put("tableName", newTableName); |
|
|
|
|
body.put("increase", !replaceOldData); |
|
|
|
|
body.put("increase", replaceOldData); |
|
|
|
|
HttpEntity entity = new StringEntity(body.toString(), StandardCharsets.UTF_8); |
|
|
|
|
HttpKits.post(String.format("%s/api/v1/datasource/table/modify", ProjectConstants.BASE_URI), headers(), entity); |
|
|
|
|
} |
|
|
|
@ -160,7 +178,7 @@ public class DatasourceOperation {
|
|
|
|
|
JSONObject body = new JSONObject(); |
|
|
|
|
body.put("tableId", tableId); |
|
|
|
|
HttpEntity entity = new StringEntity(body.toString(), StandardCharsets.UTF_8); |
|
|
|
|
String res = HttpKits.post(String.format("%s/api/v1/datasource/upload/url", ProjectConstants.BASE_URI), headers(), entity); |
|
|
|
|
String res = HttpKits.post(String.format("%s/api/v1/datasource/table/upload/url", ProjectConstants.BASE_URI), headers(), entity); |
|
|
|
|
JSONObject data = new JSONObject(res); |
|
|
|
|
return data.getString("data"); |
|
|
|
|
} |
|
|
|
|