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/config/InitConfig.java |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/smartearth/poiexcel/config/InitConfig.java b/src/main/java/com/smartearth/poiexcel/config/InitConfig.java
index b71c821..24c0e11 100644
--- a/src/main/java/com/smartearth/poiexcel/config/InitConfig.java
+++ b/src/main/java/com/smartearth/poiexcel/config/InitConfig.java
@@ -2,16 +2,20 @@
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.smartearth.poiexcel.entity.EntEntity;
 import com.smartearth.poiexcel.entity.EntResult;
 import com.smartearth.poiexcel.entity.Result;
 import com.smartearth.poiexcel.entity.TokenResult;
+import com.smartearth.poiexcel.mapper.EntMapper;
+import com.smartearth.poiexcel.service.EntService;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.springframework.boot.ApplicationArguments;
 import org.springframework.boot.ApplicationRunner;
 import org.springframework.stereotype.Component;
 
+import javax.annotation.Resource;
 import java.util.List;
 
 /**
@@ -20,15 +24,21 @@
  */
 @Component
 public class InitConfig implements ApplicationRunner {
+    @Resource
+    EntService entService;
+
+    @Resource
+    EntMapper entMapper;
+
     private final static Log log = LogFactory.getLog(InitConfig.class);
 
     @Override
     public void run(ApplicationArguments args) {
         // noinspection AlibabaRemoveCommentedCode
         try {
-            //test();
-
             log.info("***************** 绯荤粺鍚姩瀹屾瘯 *****************" + "\n");
+
+            test();
         } catch (Exception ex) {
             log.error(ex.getMessage(), ex);
         }
@@ -38,6 +48,8 @@
      * 娴嬭瘯
      */
     private void test() {
+        List<EntEntity> list = entMapper.selectList(new QueryWrapper<>());
+
         String tokenJson = "{\"success\":true,\"code\":200,\"message\":\"鎴愬姛\",\"data\":{\"ctoken\":\"ZmYxZTgyN2QxZTYyNDMxMDhjZjgzNDNiNDZiN2RjMDVAYTc3ZmFlOGE5ZGM0OGQ1Y2ZmODY4ZTFmNWYwZTEzM2E=\",\"userInfo\":{\"loginLogId\":\"1ab1675c3632428a84dc0ebe579cd66f\",\"phoneNumber\":\"\",\"displayName\":\"鏃剁┖涓�寮犲浘\",\"userMail\":\"\",\"departLevel\":\"5-1\",\"id\":\"ff1e827d1e6243108cf8343b46b7dc05\",\"userID\":\"shikong001\",\"uniqueID\":\"\",\"departName\":\"姹借溅鍜屾櫤鑳藉埗閫犱骇涓氫笓鐝璡"},\"expires\":3600,\"roles\":[]}}";
         Result rsToken = JSON.parseObject(tokenJson, Result.class);
         // TokenResult tr = JSON.parseObject(rs.getData().toJSONString(), TokenResult.class)
@@ -49,6 +61,8 @@
         EntResult er = JSONObject.parseObject(rsEnt.getData(), EntResult.class);
         List<EntEntity> entList = er.getPd().getList();
 
+        int rows = entService.insertEnts(entList);
+
         int len = tokenJson.length();
     }
 }

--
Gitblit v1.9.3