|
|
|
@ -45,8 +45,8 @@ public class TdEngineController {
|
|
|
|
|
try {
|
|
|
|
|
//调用创建数据库方法
|
|
|
|
|
this.tdEngineService.createDatabase(databaseName);
|
|
|
|
|
log.info("success for create database " + databaseName);
|
|
|
|
|
return R.ok();
|
|
|
|
|
log.info("successfully created database " + databaseName);
|
|
|
|
|
return R.ok("successfully created database " + databaseName);
|
|
|
|
|
} catch (UncategorizedSQLException e) {
|
|
|
|
|
String message = e.getCause().getMessage();
|
|
|
|
|
try {
|
|
|
|
@ -85,8 +85,8 @@ public class TdEngineController {
|
|
|
|
|
List<TdFieldVo> schemaFieldsVos = TdFieldVo.batchConvertFields(schemaFields);
|
|
|
|
|
List<TdFieldVo> tagsFieldsVos = TdFieldVo.batchConvertFields(tagsFields);
|
|
|
|
|
this.tdEngineService.createSuperTable(databaseName, superTableName, firstFieldName, schemaFieldsVos, tagsFieldsVos);
|
|
|
|
|
log.info("success for create superTable " + superTableName);
|
|
|
|
|
return R.ok("created superTable '" + superTableName + "' success");
|
|
|
|
|
log.info("successfully created superTable " + superTableName);
|
|
|
|
|
return R.ok("successfully created superTable " + superTableName);
|
|
|
|
|
} catch (UncategorizedSQLException e) {
|
|
|
|
|
String message = e.getCause().getMessage();
|
|
|
|
|
try {
|
|
|
|
@ -116,8 +116,8 @@ public class TdEngineController {
|
|
|
|
|
String tableName = tdTableVo.getTableName();
|
|
|
|
|
List<TdField> tagsFieldValues = tdTableVo.getTagsFieldValues();
|
|
|
|
|
this.tdEngineService.createTable(databaseName, superTableName, tableName, tagsFieldValues);
|
|
|
|
|
log.info("success for create table " + tableName);
|
|
|
|
|
return R.ok("created table '" + tableName + "' success");
|
|
|
|
|
log.info("successfully created table " + tableName);
|
|
|
|
|
return R.ok("successfully created table " + tableName);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
String message = e.getCause().getMessage();
|
|
|
|
|
try {
|
|
|
|
@ -146,8 +146,8 @@ public class TdEngineController {
|
|
|
|
|
try {
|
|
|
|
|
TdFieldVo addFieldVo = TdFieldVo.convertField(addTdField);
|
|
|
|
|
this.tdEngineService.addSuperTableColumn(databaseName, superTableName, addFieldVo);
|
|
|
|
|
log.info("success for add column for superTable " + superTableName + "");
|
|
|
|
|
return R.ok();
|
|
|
|
|
log.info("successfully added column for superTable " + superTableName);
|
|
|
|
|
return R.ok("successfully added column for superTable " + superTableName);
|
|
|
|
|
} catch (UncategorizedSQLException e) {
|
|
|
|
|
String message = e.getCause().getMessage();
|
|
|
|
|
try {
|
|
|
|
@ -178,8 +178,40 @@ public class TdEngineController {
|
|
|
|
|
try {
|
|
|
|
|
TdFieldVo dropFieldVo = TdFieldVo.convertField(dropField);
|
|
|
|
|
this.tdEngineService.dropSuperTableColumn(databaseName, superTableName, dropFieldVo);
|
|
|
|
|
log.info("successful operation: drop column for superTable '" + superTableName + "' success");
|
|
|
|
|
return R.ok();
|
|
|
|
|
log.info("successfully droped column of superTable " + superTableName);
|
|
|
|
|
return R.ok("successfully droped column of superTable " + superTableName);
|
|
|
|
|
} catch (UncategorizedSQLException e) {
|
|
|
|
|
String message = e.getCause().getMessage();
|
|
|
|
|
try {
|
|
|
|
|
message = message.substring(message.lastIndexOf("invalid operation"));
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
}
|
|
|
|
|
log.error(message);
|
|
|
|
|
return R.fail(message);
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
log.error(e.getMessage());
|
|
|
|
|
return R.fail(e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param: alterTagVo
|
|
|
|
|
* @description 修改子表tag值
|
|
|
|
|
* @author xins
|
|
|
|
|
* @date 2023-08-30 11:17
|
|
|
|
|
* @return R<?>
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/alterTableTag")
|
|
|
|
|
public R<?> alterTableTag(@Validated @RequestBody AlterTagVo alterTagVo) {
|
|
|
|
|
String databaseName = alterTagVo.getDatabaseName();
|
|
|
|
|
String tableName = alterTagVo.getTableName();
|
|
|
|
|
String tagName = alterTagVo.getTagName();
|
|
|
|
|
Object tagValue = alterTagVo.getTagValue();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
this.tdEngineService.alterTableTag(databaseName,tableName,tagName,tagValue);
|
|
|
|
|
log.info("successfully altered tag "+tagName+" value to "+tagValue+" of tableName");
|
|
|
|
|
return R.ok("successfully altered tag "+tagName+" value to "+tagValue+" of tableName");
|
|
|
|
|
} catch (UncategorizedSQLException e) {
|
|
|
|
|
String message = e.getCause().getMessage();
|
|
|
|
|
try {
|
|
|
|
|