新增MySQL和pg数据库的同步
This commit is contained in:
@@ -66,24 +66,6 @@ public class SyncTask implements Serializable {
|
|||||||
@TableField("target_table")
|
@TableField("target_table")
|
||||||
private String targetTable;
|
private String targetTable;
|
||||||
|
|
||||||
/**
|
|
||||||
* 同步类型(如全量同步、增量同步等)
|
|
||||||
*/
|
|
||||||
@TableField("sync_type")
|
|
||||||
private String syncType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 增量同步字段(用于增量同步时的判断依据)
|
|
||||||
*/
|
|
||||||
@TableField("increment_column")
|
|
||||||
private String incrementColumn;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 定时任务表达式( cron表达式 )
|
|
||||||
*/
|
|
||||||
@TableField("cron_expression")
|
|
||||||
private String cronExpression;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否激活(任务启用状态标识)
|
* 是否激活(任务启用状态标识)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ public class taskDbSync {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取PostgreSQL兼容的字段定义
|
* 获取PostgresSQL兼容的字段定义
|
||||||
*/
|
*/
|
||||||
private List<String> getColumnDefinitions(JdbcTemplate sourceJdbc, String tableName) throws SQLException {
|
private List<String> getColumnDefinitions(JdbcTemplate sourceJdbc, String tableName) throws SQLException {
|
||||||
List<String> definitions = new ArrayList<>();
|
List<String> definitions = new ArrayList<>();
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class demo {
|
|||||||
.pathInfo(Collections.singletonMap(OutputFile.xml, System.getProperty("user.dir") + "/src/main/resources/mapper"));
|
.pathInfo(Collections.singletonMap(OutputFile.xml, System.getProperty("user.dir") + "/src/main/resources/mapper"));
|
||||||
})
|
})
|
||||||
.strategyConfig(builder -> {
|
.strategyConfig(builder -> {
|
||||||
builder.addInclude("biz_sync_task,biz_db_config")
|
builder.addInclude("biz_sync_task")
|
||||||
.addTablePrefix("biz_")
|
.addTablePrefix("biz_")
|
||||||
.entityBuilder()
|
.entityBuilder()
|
||||||
.enableLombok()
|
.enableLombok()
|
||||||
@@ -45,7 +45,8 @@ public class demo {
|
|||||||
.formatServiceImplFileName("%sServiceImpl")
|
.formatServiceImplFileName("%sServiceImpl")
|
||||||
.mapperBuilder()
|
.mapperBuilder()
|
||||||
.enableBaseResultMap()
|
.enableBaseResultMap()
|
||||||
.enableBaseColumnList();
|
.enableBaseColumnList()
|
||||||
|
.enableFileOverride(); // 开启mapper接口和xml文件覆盖
|
||||||
})
|
})
|
||||||
.templateEngine(new FreemarkerTemplateEngine())
|
.templateEngine(new FreemarkerTemplateEngine())
|
||||||
.execute();
|
.execute();
|
||||||
|
|||||||
@@ -11,9 +11,6 @@
|
|||||||
<result column="target_db_id" property="targetDbId" />
|
<result column="target_db_id" property="targetDbId" />
|
||||||
<result column="source_table" property="sourceTable" />
|
<result column="source_table" property="sourceTable" />
|
||||||
<result column="target_table" property="targetTable" />
|
<result column="target_table" property="targetTable" />
|
||||||
<result column="sync_type" property="syncType" />
|
|
||||||
<result column="increment_column" property="incrementColumn" />
|
|
||||||
<result column="cron_expression" property="cronExpression" />
|
|
||||||
<result column="is_active" property="isActive" />
|
<result column="is_active" property="isActive" />
|
||||||
<result column="last_sync_time" property="lastSyncTime" />
|
<result column="last_sync_time" property="lastSyncTime" />
|
||||||
<result column="update_time" property="updateTime" />
|
<result column="update_time" property="updateTime" />
|
||||||
@@ -25,7 +22,7 @@
|
|||||||
|
|
||||||
<!-- 通用查询结果列 -->
|
<!-- 通用查询结果列 -->
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
create_time, task_id, task_name, source_db_id, target_db_id, source_table, target_table, sync_type, increment_column, cron_expression, is_active, last_sync_time, update_time, f_tenant_id, f_flow_id, f_flow_task_id, f_flow_state
|
create_time, task_id, task_name, source_db_id, target_db_id, source_table, target_table, is_active, last_sync_time, update_time, f_tenant_id, f_flow_id, f_flow_task_id, f_flow_state
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user