数据添加更改

master
lwj 2024-09-08 16:41:51 +08:00
parent 288e36e2e7
commit af270c644b
1 changed files with 4 additions and 0 deletions

View File

@ -179,6 +179,7 @@ public class ProductServiceImpl implements ProductService {
HikariDataSource hikariDataSource = HikariPool.getHikariDataSource(dataSources);
ExecutorService executorService = Executors.newFixedThreadPool(8);
AtomicInteger addCount = new AtomicInteger();
// 分割数据为3000个批次
@ -189,6 +190,7 @@ public class ProductServiceImpl implements ProductService {
for (DataValue[][] batch : batches) {
log.info("数量batch{}", batch.length);
executorService.submit(() -> {
try (Statement stmt = conn.createStatement()) {
@ -226,6 +228,8 @@ public class ProductServiceImpl implements ProductService {
}
private String buildBatchInsertSQL(String tableName, DataValue[][] batch) {
log.info("陈思豪是傻逼"+tableName);
StringBuilder columns = new StringBuilder("(");
StringBuilder values = new StringBuilder("VALUES ");
// 构建字段名