Эх сурвалжийг харах

修改jdbcTemplate 的实现类 ,解决实例化的问题。

CodeLife Leno 2 сар өмнө
parent
commit
aa01480ba7

+ 8 - 5
Procedure/backend/project/src/main/java/com/sundata/product/taskExecute/service/KingBase2GBaseService.java

@@ -7,7 +7,6 @@ import com.sundata.product.rwa.calc.service.implement.extend.UpperMapRowMapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
 import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
 import org.springframework.stereotype.Service;
@@ -86,12 +85,16 @@ public class KingBase2GBaseService {
         otherJdbc.update("delete from " + tableName);
         int x = 0;
         for (Map<String, Object> map : data) {
-            otherJdbc.update(sql,new MapSqlParameterSource(map));
-            if (x++%10==0){
-                otherJdbc.update("commit");
+            otherJdbc.update(sql, new MapSqlParameterSource(map));
+            if (x++ % 10 == 0) {
+                otherJdbc.execute("commit", (o) -> {
+                    o.execute();
+                });
             }
         }
-        otherJdbc.update("commit");
+        otherJdbc.execute("commit", (o) -> {
+            o.execute();
+        });
     }