feature(web): 增加 hdfs 路径补全
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,11 +43,9 @@ public class SqlBuilderTests {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(SqlFormatter.format(
|
||||
SqlBuilder.select("count(*) > 0")
|
||||
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_ID, 1552408244680593408L)
|
||||
.andEq(TABLE_INFO_ALIAS, "crm_order_ord_prod_inst_sub_his")
|
||||
.andEq(TABLE_FLINK_JOB_STATUS, "y")
|
||||
.andEq(TABLE_INFO_STATUS, "y")
|
||||
.build()
|
||||
|
||||
Reference in New Issue
Block a user