From e60b6c9cdc11fd436a0bcae225d1789db04c9504 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期四, 05 十月 2023 16:37:11 +0800
Subject: [PATCH] 测试数据入库功能

---
 src/main/java/com/smartearth/poiexcel/service/EntService.java |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/smartearth/poiexcel/service/EntService.java b/src/main/java/com/smartearth/poiexcel/service/EntService.java
index 94165f8..24b5270 100644
--- a/src/main/java/com/smartearth/poiexcel/service/EntService.java
+++ b/src/main/java/com/smartearth/poiexcel/service/EntService.java
@@ -1,7 +1,9 @@
 package com.smartearth.poiexcel.service;
 
 import com.alibaba.fastjson.JSONObject;
+import com.google.common.collect.Lists;
 import com.smartearth.poiexcel.entity.*;
+import com.smartearth.poiexcel.mapper.BasicMapper;
 import com.smartearth.poiexcel.mapper.EntMapper;
 import com.smartearth.poiexcel.utils.RestHelper;
 import org.apache.commons.logging.Log;
@@ -98,6 +100,28 @@
     }
 
     /**
+     * 鎻掑叆浼佷笟
+     */
+    public Integer insertEnts(List<EntEntity> list) {
+        try {
+            int rows = 0;
+            List<List<EntEntity>> subLists = Lists.partition(list, StaticData.I200);
+            for (List<EntEntity> sub : subLists) {
+                try {
+                    rows += entMapper.insertBatch(sub);
+                } catch (Exception ex) {
+                    log.error(ex);
+                }
+            }
+
+            return rows;
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
+            return 0;
+        }
+    }
+
+    /**
      * get璇锋眰锛圧est锛�
      */
     public <T> T getForRest(String url, Class<T> clazz) {

--
Gitblit v1.9.3