Prechádzať zdrojové kódy

平均环境温度,批量

malijun 5 mesiacov pred
rodič
commit
25b9fc1311

+ 14 - 2
ruoyi-admin/src/test/java/com/ruoyi/Test.java

@@ -56,6 +56,11 @@ public class Test {
 
         List<PointInfo> pointInfos = javaFunctionJobHandler.getEntity("AI072", "turbine");
 
+        //插入集合
+        List<TurbineInfoDay > interest = new ArrayList<>();
+        //更新集合
+        List<TurbineInfoDay > update = new ArrayList<>();
+
 
         //遍历pointInfos
         for (PointInfo turbine : pointInfos) {
@@ -82,18 +87,25 @@ public class Test {
                 turbineInfoDay.setRecordDate(timeBegin.toJdkDate());
                 turbineInfoDay.setHjwd(avgCutInWindSpeed);
                 System.out.println(turbineInfoDay);
+                interest.add(turbineInfoDay);
 //                turbineInfoDayService.save(turbineInfoDay);
             } else {
                 one.setHjwd(avgCutInWindSpeed);
                 System.out.println(one);
+                update.add(one);
 //                turbineInfoDayService.updateById(one);
             }
 
-
         }
+//        //批量插入
+//        turbineInfoDayService.saveBatch(interest);
+//        //批量更新
+//        turbineInfoDayService.updateBatchById(update);
+//        //批量插入或更新
+//        turbineInfoDayService.saveOrUpdateBatch(interest);
+//        turbineInfoDayService.saveOrUpdateBatch(update);
 
 
     }
 }
 
-}