Commit 61aed89a authored by 黎博's avatar 黎博

新增接口tableList

parent 23fb7de5
......@@ -105,6 +105,17 @@ public class DbSyncController {
return JsonResult.buildSuccessResult(tableList);
}
/**
* 跟数据库同步脚本使用的接口
* @param database 数据库名
* @return
*/
@GetMapping("/tableList")
public String getTableListForSync(@RequestParam String database) {
List<String> tableList = databaseSyncService.getTableListByDb(ip, port, username, password, database);
return StringUtils.join(tableList, " ");
}
/**
* 老数据库同步,调用Jenkins job sync_database_schema
* @param dbName 数据库名
......
......@@ -158,7 +158,6 @@ public class DatabaseSyncServiceImpl implements DatabaseSyncService {
StringBuilder insertSql = new StringBuilder();
while (selectResultSet.next()) {
String rowValues = getRowValues(selectResultSet, columnNameList.size(), columnTypeList);
// String insertSql = String.format("insert into %s (%s) values(%s);", tableName, columnArrayStr, rowValues);
insertSql
.append("insert into ")
.append(tableName)
......
......@@ -32,7 +32,7 @@ public class DbSyncTask {
private String password;
// @Scheduled(cron = "0 0 24 * * ?")
@Scheduled(cron = "0 15 15 * * ?")
@Scheduled(cron = "0 38 15 * * ?")
public void getDbInfoFromSourceJob() {
List<String> dbList = databaseSyncService.getDatabaseList(ip, port, username, password);
for (String dbName: dbList) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment