feature(web): 增加 hdfs 路径补全

This commit is contained in:
2023-07-07 15:55:27 +08:00
parent bd0a56217d
commit b13e70d9cb
6 changed files with 117 additions and 22 deletions

View File

@@ -225,4 +225,19 @@ public class InfoController {
public Boolean nonExistsTable(@RequestParam(value = "flink_job_id") Long flinkJobId, @RequestParam(value = "alias") String alias) {
return !infoService.existsTable(flinkJobId, alias);
}
@GetMapping("/all_flink_job_id")
public ImmutableList<Long> allFlinkJobId() {
return infoService.allFlinkJobId();
}
@GetMapping("/all_alias")
public ImmutableList<String> allAlias() {
return infoService.allAlias();
}
@GetMapping("/all_hdfs")
public ImmutableList<String> allHdfs() {
return infoService.allHdfs();
}
}

View File

@@ -242,6 +242,7 @@ public class InfoService {
private static final String TABLE_INFO_ALIAS = column(TABLE_INFO, "alias");
private static final String TABLE_INFO_PRIORITY = column(TABLE_INFO, "priority");
private static final String TABLE_INFO_STATUS = column(TABLE_INFO, "status");
private static final String TABLE_INFO_TARGET_HDFS = column(TABLE_INFO, "tgt_hdfs_path");
private static final Alias TABLE_SYNC_STATE = Alias.of(StrUtil.format("{}.tb_app_hudi_sync_state", DATABASE_NAME), "tahss");
private static final String TABLE_SYNC_STATE_ID = column(TABLE_SYNC_STATE, "id");
@@ -745,4 +746,44 @@ public class InfoService {
Boolean.class
);
}
@Cacheable(value = "all-flink-job-id", sync = true, cacheManager = "long-cache")
@Retryable(Throwable.class)
public ImmutableList<Long> allFlinkJobId() {
return Lists.immutable.ofAll(mysqlJdbcTemplate.queryForList(
SqlBuilder.select(StrUtil.format("distinct {}", TABLE_FLINK_JOB_ID))
.from(TABLE_FLINK_JOB)
.whereEq(TABLE_FLINK_JOB_STATUS, "y")
.build(),
Long.class
));
}
@Cacheable(value = "all-alias", sync = true, cacheManager = "long-cache")
@Retryable(Throwable.class)
public ImmutableList<String> allAlias() {
return Lists.immutable.ofAll(mysqlJdbcTemplate.queryForList(
SqlBuilder.select(StrUtil.format("distinct {}", TABLE_INFO_ALIAS))
.from(TABLE_INFO, TABLE_FLINK_JOB)
.whereEq(TABLE_INFO_FLINK_JOB_ID, Column.as(TABLE_FLINK_JOB_ID))
.andEq(TABLE_FLINK_JOB_STATUS, "y")
.andEq(TABLE_INFO_STATUS, "y")
.build(),
String.class
));
}
@Cacheable(value = "all-hdfs", sync = true, cacheManager = "long-cache")
@Retryable(Throwable.class)
public ImmutableList<String> allHdfs() {
return Lists.immutable.ofAll(mysqlJdbcTemplate.queryForList(
SqlBuilder.select(StrUtil.format("distinct {}", TABLE_INFO_TARGET_HDFS))
.from(TABLE_INFO, TABLE_FLINK_JOB)
.whereEq(TABLE_INFO_FLINK_JOB_ID, Column.as(TABLE_FLINK_JOB_ID))
.andEq(TABLE_FLINK_JOB_STATUS, "y")
.andEq(TABLE_INFO_STATUS, "y")
.build(),
String.class
));
}
}