提交更新返回值

master
lwj 2024-09-08 13:37:18 +08:00
parent f77f4928e3
commit a2fa5ee7df
1 changed files with 31 additions and 37 deletions

View File

@ -49,15 +49,7 @@ public class ProductServiceImpl implements ProductService {
try {
connection = hikariDataSource.getConnection();
// 遍历外部列表
for (DataValue[] dataValues : listList) {
log.info("bbbbbb");
for (DataValue dataValue : dataValues) {
log.info("man{}",dataValue);
}
}
log.info("aaaaaaaaaaaaaaaaaaaaaa");
for (DataValue[] dataValueList : listList) {
log.info("便利化后的外部列表的值是{}",dataValueList.toString());
Connection finalConnection = connection;
executorService.submit(() -> {
try {
@ -161,10 +153,10 @@ public class ProductServiceImpl implements ProductService {
// 循环设置参数并执行插入
for (DataValue dataValue : dataValueList) {
log.info("循环的值为:"+dataValue.toString());
// for (DataValue dataValue : dataValueList) {
int index = 1;
Object obj = dataValue.getValue();
for (DataValue value : dataValueList) {
Object obj = value.getValue();
if (obj instanceof String) {
ps.setString(index++, (String) obj);
log.info("类型为String,值{}",obj);
@ -188,10 +180,12 @@ public class ProductServiceImpl implements ProductService {
log.info("类型为Long,值{}",obj);
} else {
ps.setObject(index++, obj);
log.info("类型为obj,值{}",obj);
log.info("类型为OOO,值{}",obj);
}
}
ps.addBatch();
// }
// 执行批量插入操作
int[] ints = ps.executeBatch();