|
|
@ -41,12 +41,16 @@ public class SyncXtData2022 {
|
|
|
|
arp2.start();
|
|
|
|
arp2.start();
|
|
|
|
|
|
|
|
|
|
|
|
String sql = "select tablename from pg_tables where schemaname='public'";
|
|
|
|
String sql = "select tablename from pg_tables where schemaname='public'";
|
|
|
|
List<Record> tableList = Db.use("source").find(sql);
|
|
|
|
List<Record> sourceTableList = Db.use("source").find(sql);
|
|
|
|
|
|
|
|
|
|
|
|
for (Record tableRecord : tableList) {
|
|
|
|
for (Record sourceTable : sourceTableList) {
|
|
|
|
String tableName = tableRecord.getStr("tablename");
|
|
|
|
String tableName = sourceTable.getStr("tablename");
|
|
|
|
sql = "select a.attname as name from pg_class as c,pg_attribute as a where c.relname = '" + tableName + "' and a.attrelid = c.oid and a.attnum>0";
|
|
|
|
sql = "select a.attname as name from pg_class as c,pg_attribute as a where c.relname = '" + tableName + "' and a.attrelid = c.oid and a.attnum>0";
|
|
|
|
List<Record> colsListTarge = Db.use("target").find(sql);
|
|
|
|
List<Record> colsListTarge = Db.use("target").find(sql);
|
|
|
|
|
|
|
|
if (colsListTarge.size() == 0) {
|
|
|
|
|
|
|
|
System.out.println("发现表:" + tableName + "不存在,跳过!");
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
List<Record> colsListSource = Db.use("source").find(sql);
|
|
|
|
List<Record> colsListSource = Db.use("source").find(sql);
|
|
|
|
Set<String> targetSet = new HashSet<>();
|
|
|
|
Set<String> targetSet = new HashSet<>();
|
|
|
|
for (Record rCol : colsListTarge) {
|
|
|
|
for (Record rCol : colsListTarge) {
|
|
|
|