新增MySQL和pg数据库的同步

This commit is contained in:
2025-08-27 13:05:59 +08:00
parent 7a05d892ce
commit a97619d459

View File

@@ -56,8 +56,6 @@ public class taskDbSync {
JdbcTemplate targetJdbc = DataSourceConfig.createJdbcTemplate(targetDbConfig);
// 3. 执行表同步逻辑(异步执行)
syncTableData(task, sourceJdbc, targetJdbc);
// 同步成功日志
System.out.println("任务 " + task.getTaskId() + "" + task.getSourceTable() + "" + task.getTargetTable() + ")已提交至后台执行");
} catch (Exception e) {
// 捕获任务执行异常,记录错误信息(仅后台打印,不阻塞接口)
String errorMsg = "任务 " + task.getTaskId() + " 同步失败: " + e.getMessage();
@@ -84,7 +82,6 @@ public class taskDbSync {
// 确保源表和目标表名转为小写
String sourceTable = task.getSourceTable().toLowerCase();
String targetTable = task.getTargetTable().toLowerCase();
// 1. 检查并创建目标表
if (!tableExists(targetJdbc, targetTable)) {
createTargetTable(sourceJdbc, targetJdbc, sourceTable, targetTable);