Browse Source

更新数据加载处理过程。

CodeLife_leno 2 months ago
parent
commit
e63651828f

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

@@ -72,7 +72,7 @@ public class KingBase2GBaseService {
 
         List<Map<String, Object>> data = thisJdbc.query("select * from " + tableName, new UpperMapRowMapper());
         if (data.isEmpty()) {
-            log.warn("{}表中数据为空,不尽兴转换,请确认实际为空真实性", tableName);
+            log.warn("{}表中数据为空,不进行转换,请确认实际为空真实性", tableName);
             return;
         }
         Set<String> keys = data.get(0).keySet();
@@ -81,12 +81,16 @@ public class KingBase2GBaseService {
         String insertSqlValue = ":" + CollectionUtil.join(sortedKeys, ", :");
         String sql = "insert into " + tableName + "(" + insertSqlKey + ") values(" + insertSqlValue + ")";
         log.debug("执行的SQL为:{}", sql);
-        MapSqlParameterSource sqlParam = new MapSqlParameterSource();
-        otherJdbc.update("delete from " + tableName, sqlParam);
+        MapSqlParameterSource sqlParam;
+        otherJdbc.update("delete from " + tableName);
+        int x = 0;
         for (Map<String, Object> map : data) {
-            otherJdbc.update(sql, map);
-            ;
+            otherJdbc.update(sql,new MapSqlParameterSource(map));
+            if (x++%10==0){
+                otherJdbc.update("commit");
+            }
         }
+        otherJdbc.update("commit");
     }