From 8e8628fd7a5f67836f496e9e5da0a724ed9fe1e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=B5=B7?= <10402852@qq.com> Date: Thu, 27 Apr 2023 10:21:54 +0800 Subject: [PATCH 1/3] 'commit' --- src/main/java/Tools/XT_SyncData2022.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/Tools/XT_SyncData2022.java b/src/main/java/Tools/XT_SyncData2022.java index 4b733a0..50a49cb 100644 --- a/src/main/java/Tools/XT_SyncData2022.java +++ b/src/main/java/Tools/XT_SyncData2022.java @@ -8,6 +8,7 @@ import com.jfinal.plugin.activerecord.Record; import com.jfinal.plugin.activerecord.dialect.PostgreSqlDialect; import com.jfinal.plugin.druid.DruidPlugin; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -24,8 +25,8 @@ public class XT_SyncData2022 { arp1.start(); //写入库 - DruidPlugin druid2 = new DruidPlugin("jdbc:postgresql://10.10.14.231:5432/eduData_xt", "postgres", - "dsideal", "org.postgresql.Driver"); + DruidPlugin druid2 = new DruidPlugin("jdbc:postgresql://www.wmarkj.com:27027/eduData_db", "postgres", + "DsideaL147258369", "org.postgresql.Driver"); druid2.start(); ActiveRecordPlugin arp2 = new ActiveRecordPlugin("target", druid2); arp2.setDialect(new PostgreSqlDialect()); @@ -53,7 +54,7 @@ public class XT_SyncData2022 { } List list = Db.use("source").findAll(tableName); - + List writeList = new ArrayList<>(); int cnt = 0; for (Record sourceRecord : list) { cnt++; @@ -75,10 +76,11 @@ public class XT_SyncData2022 { rWrite.set(str, "");//加上默认值 } rWrite.set("recordyear", 2022); - //3、保存 - Db.use("target").save(tableName, "id", rWrite); - System.out.println("正在处理表【" + tableName + "】,第" + cnt + "条数据,当前表共" + list.size() + "条。"); + writeList.add(rWrite); } + //3、保存 + System.out.println(CommonUtil.GetCurrentTimeString() + " 正在处理表【" + tableName + "】,当前表共" + writeList.size() + "条。"); + Db.use("target").batchSave(tableName, writeList, 200); } CommonUtil.printf("恭喜,所有导入工作成功完成!"); } From 2021ddf00161534347daa43d29145a72251a80ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=B5=B7?= <10402852@qq.com> Date: Thu, 27 Apr 2023 11:27:35 +0800 Subject: [PATCH 2/3] 'commit' --- src/main/java/Tools/Tables.txt | 326 ++++++++++++++++++++ src/main/java/Tools/XT_SyncData2022New.java | 60 ++++ 2 files changed, 386 insertions(+) create mode 100644 src/main/java/Tools/Tables.txt create mode 100644 src/main/java/Tools/XT_SyncData2022New.java diff --git a/src/main/java/Tools/Tables.txt b/src/main/java/Tools/Tables.txt new file mode 100644 index 0000000..32abcb0 --- /dev/null +++ b/src/main/java/Tools/Tables.txt @@ -0,0 +1,326 @@ +表信息 +对象信息 +分析教基1001 +分析教基1002续 +分析教基1003续 +分析教基1004续 +分析教基1005 +分析教基1006 +分析教基2001 +教基1001 +教基1102 +教基1102续 +教基1203 +教基2105 +教基2106 +教基2107 +教基2108 +教基2109 +教基3040 +教基3041 +教基3045 +教基3046 +教基3111 +教基3112 +教基3113 +教基3114 +教基3115 +教基3116 +教基3117 +教基3118 +教基3119 +教基3120 +教基3142 +教基3221 +教基3221续1 +教基3222 +教基3223 +教基3244 +教基3343 +教基3347 +教基4063 +教基4064 +教基4067 +教基4068 +教基4148 +教基4149 +教基4150 +教基4153 +教基4155 +教基4156 +教基4159 +教基4251 +教基4257 +教基4261 +教基4354 +教基4360 +教基5169 +教基5170 +教基5171 +教基5175 +教基5176 +教基5272 +教基5377 +教基6178 +教基7181 +教基7182 +教基7283 +教基7284 +教基8389 +教基综1020 +教基综1021 +教基综1022 +教基综1023 +教基综1024 +教基综2050 +教基综2051 +教基综2052 +教基综2061 +教基综2062 +教基综2071 +教基综2072 +教基综2090 +教基综3110 +教基综3111 +教基综3112 +教基综3113 +教基综3114 +教基综3115 +教基综3116 +教基综3117 +教基综3118 +教基综3119 +教基综3121 +教基综3122 +教基综3123 +教基综3124 +教基综3125 +教基综3126 +教基综3151 +教基综3152 +教基综3153 +教基综3154 +教基综3155 +教基综3156 +教基综3181 +教基综3182 +教基综3183 +教基综3184 +教基综3185 +教基综3201 +教基综3202 +教基综3203 +教基综3204 +教基综3401 +教基综3402 +教基综3403 +教基综3404 +教基综3411 +教基综3412 +教基综3413 +教基综3414 +教基综3421 +教基综3422 +教基综3423 +教基综3424 +教基综3451 +教基综3452 +教基综3453 +教基综3454 +教基综3461 +教基综3462 +教基综3463 +教基综3464 +教基综3900 +教基综4480 +教基综4481 +教基综4491 +教基综4492 +教基综4500 +教基综4530 +教基综4531 +教基综4532 +教基综4533 +教基综4534 +教基综4535 +教基综4536 +教基综4551 +教基综4552 +教基综4553 +教基综4554 +教基综4561 +教基综4562 +教基综4563 +教基综4564 +教基综4591 +教基综4592 +教基综4631 +教基综4632 +教基综4633 +教基综4634 +教基综4640 +教基综4671 +教基综4672 +教基综4673 +教基综4674 +教基综4681 +教基综4682 +教基综4683 +教基综4684 +教基综4900 +教基综4901 +教基综4902 +教基综4903 +教基综4904 +教基综5691 +教基综5692 +教基综5693 +教基综5694 +教基综5701 +教基综5702 +教基综5703 +教基综5704 +教基综5711 +教基综5712 +教基综5713 +教基综5714 +教基综5750 +教基综5761 +教基综5762 +教基综5763 +教基综5901 +教基综5902 +教基综5903 +教基综5904 +教基综5905 +教基综5906 +教基综6780 +教基综6790 +教基综6800 +教基综6900 +教基综7810 +教基综7820 +教基综8051 +教基综8061 +教基综8071 +教基综8072 +教基综8081 +教基综8091 +教基综57011 +教基综57012 +教基综57013 +教基综57014 +教基综57021 +教基综57022 +教基综57023 +教基综57024 +教基综57031 +教基综57032 +教基综57033 +教基综57034 +教基综57041 +教基综57042 +教基综57043 +教基综57044 +教中综1030 +教中综1031 +教中综1032 +教中综1033 +教中综1034 +教中综1035 +教中综1036 +教中综1037 +教中综2090 +教中综3211 +教中综3212 +教中综3213 +教中综3214 +教中综3215 +教中综3216 +教中综3221 +教中综3222 +教中综3230 +教中综3401 +教中综3402 +教中综3410 +教中综3430 +教中综3440 +教中综3450 +教中综3460 +教中综3471 +教中综3472 +教中综3473 +教中综3474 +教中综3475 +教中综3476 +教中综3477 +教中综4511 +教中综4512 +教中综4513 +教中综4514 +教中综4515 +教中综4516 +教中综4541 +教中综4542 +教中综4543 +教中综4544 +教中综4545 +教中综4546 +教中综4571 +教中综4572 +教中综4573 +教中综4574 +教中综4575 +教中综4576 +教中综4601 +教中综4602 +教中综4603 +教中综4604 +教中综4605 +教中综4606 +教中综4611 +教中综4612 +教中综4613 +教中综4614 +教中综4615 +教中综4616 +教中综4631 +教中综4632 +教中综4633 +教中综4634 +教中综4635 +教中综4636 +教中综4671 +教中综4672 +教中综4673 +教中综4674 +教中综4675 +教中综4676 +教中综4681 +教中综4682 +教中综4683 +教中综4684 +教中综4685 +教中综4686 +教中综5721 +教中综5722 +教中综5723 +教中综5724 +教中综5725 +教中综5726 +教中综5771 +教中综5772 +教中综5773 +教中综5774 +教中综5775 +教中综5776 +教中综6801 +教中综6802 +教中综6803 +教中综6804 +教中综6805 +教中综6806 +教中综6807 +教中综7830 +教中综7840 +教中综8210 \ No newline at end of file diff --git a/src/main/java/Tools/XT_SyncData2022New.java b/src/main/java/Tools/XT_SyncData2022New.java new file mode 100644 index 0000000..658d82b --- /dev/null +++ b/src/main/java/Tools/XT_SyncData2022New.java @@ -0,0 +1,60 @@ +package Tools; + +import cn.hutool.core.io.FileUtil; +import com.dsideal.FengHuang.Util.CommonUtil; +import com.jfinal.kit.StrKit; +import com.jfinal.plugin.activerecord.ActiveRecordPlugin; +import com.jfinal.plugin.activerecord.Db; +import com.jfinal.plugin.activerecord.Record; +import com.jfinal.plugin.activerecord.dialect.PostgreSqlDialect; +import com.jfinal.plugin.druid.DruidPlugin; +import org.bouncycastle.util.encoders.UTF8; + +import java.io.File; +import java.nio.charset.Charset; +import java.util.*; + +public class XT_SyncData2022New { + /** + * 获得24个长度的十六进制的UUID + * + * @return UUID + */ + public static String get24UUID() { + UUID id = UUID.randomUUID(); + String[] idd = id.toString().split("-"); + return idd[0] + idd[1] + idd[4]; + } + + + public static void main(String[] args) { + DruidPlugin druid = new DruidPlugin("jdbc:postgresql://www.wmarkj.com:27027/eduData_db", "postgres", + "DsideaL147258369", "org.postgresql.Driver"); + druid.start(); + ActiveRecordPlugin arp = new ActiveRecordPlugin(druid); + arp.setDialect(new PostgreSqlDialect()); + arp.start(); + + String tablesTxt = "D:\\dsWork\\YangPuBaoMing\\src\\main\\java\\Tools\\Tables.txt"; + List list = FileUtil.readLines(new File(tablesTxt), Charset.defaultCharset()); + for (String s : list) { + String sql = "delete from " + s + " where recordyear=2022"; + Db.update(sql); + } + for (String s : list) { + String sql = "select * from " + s + " where recordyear=2021"; + List listT = Db.find(sql); + List writeList = new ArrayList<>(); + if (listT != null && listT.size() > 0) { + System.out.println(CommonUtil.GetCurrentTimeString() + " 正在进行表" + s + "的数据生成工作"); + for (Record record : listT) { + record.set("recordyear", 2022); + record.set("id", get24UUID()); + writeList.add(record); + } + Db.batchSave(s, writeList, 200); + } + } + CommonUtil.printf("恭喜,所有导入工作成功完成!"); + } +} From 2e8bb1a2993eb03f2bbf1f78b1e69fd31b04f894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=B5=B7?= <10402852@qq.com> Date: Wed, 10 May 2023 08:12:19 +0800 Subject: [PATCH 3/3] 'commit' --- .../resource/ExcelExportTemplate/YangPuZhaoShengExcel.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resource/ExcelExportTemplate/YangPuZhaoShengExcel.json b/src/main/resource/ExcelExportTemplate/YangPuZhaoShengExcel.json index 9c55dbc..d50207b 100644 --- a/src/main/resource/ExcelExportTemplate/YangPuZhaoShengExcel.json +++ b/src/main/resource/ExcelExportTemplate/YangPuZhaoShengExcel.json @@ -27,12 +27,12 @@ }, { "show_column_name": "父亲姓名", - "list_column_name": "address", + "list_column_name": "father_name", "width": 20 }, { "show_column_name": "母亲姓名", - "list_column_name": "address", + "list_column_name": "mother_name", "width": 16 }, {