From 3706d2e1db45e64a1375b92300901de39e35e464 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期二, 25 一月 2022 21:50:54 +0800
Subject: [PATCH] update 去除链式调用注解 不符合规范导致很多奇葩问题 例如: copy为空问题

---
 ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestBatchController.java |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestBatchController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestBatchController.java
index a9b4dbd..78ffef9 100644
--- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestBatchController.java
+++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestBatchController.java
@@ -8,7 +8,6 @@
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -24,7 +23,7 @@
  * @date 2021-05-30
  */
 @Api(value = "娴嬭瘯鎵归噺鏂规硶", tags = {"娴嬭瘯鎵归噺鏂规硶"})
-@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RequiredArgsConstructor
 @RestController
 @RequestMapping("/demo/batch")
 public class TestBatchController extends BaseController {
@@ -36,7 +35,7 @@
 
     /**
      * 鏂板鎵归噺鏂规硶 鍙畬缇庢浛浠� saveBatch 绉掔骇鎻掑叆涓婁竾鏁版嵁 (瀵筸ysql璐熻嵎杈冨ぇ)
-     *
+     * <p>
      * 3.5.0 鐗堟湰 澧炲姞 rewriteBatchedStatements=true 鎵瑰鐞嗗弬鏁� 浣� MP 鍘熺敓鎵瑰鐞嗗彲浠ヨ揪鍒板悓鏍风殑閫熷害
      */
     @ApiOperation(value = "鏂板鎵归噺鏂规硶")
@@ -45,14 +44,18 @@
     public AjaxResult<Void> add() {
         List<TestDemo> list = new ArrayList<>();
         for (int i = 0; i < 1000; i++) {
-            list.add(new TestDemo().setOrderNum(-1L).setTestKey("鎵归噺鏂板").setValue("娴嬭瘯鏂板"));
+            TestDemo testDemo = new TestDemo();
+            testDemo.setOrderNum(-1L);
+            testDemo.setTestKey("鎵归噺鏂板");
+            testDemo.setValue("娴嬭瘯鏂板");
+            list.add(testDemo);
         }
         return toAjax(testDemoMapper.insertBatch(list) ? 1 : 0);
     }
 
     /**
      * 鏂板鎴栨洿鏂� 鍙畬缇庢浛浠� saveOrUpdateBatch 楂樻�ц兘
-     *
+     * <p>
      * 3.5.0 鐗堟湰 澧炲姞 rewriteBatchedStatements=true 鎵瑰鐞嗗弬鏁� 浣� MP 鍘熺敓鎵瑰鐞嗗彲浠ヨ揪鍒板悓鏍风殑閫熷害
      */
     @ApiOperation(value = "鏂板鎴栨洿鏂版壒閲忔柟娉�")
@@ -61,12 +64,16 @@
     public AjaxResult<Void> addOrUpdate() {
         List<TestDemo> list = new ArrayList<>();
         for (int i = 0; i < 1000; i++) {
-            list.add(new TestDemo().setOrderNum(-1L).setTestKey("鎵归噺鏂板").setValue("娴嬭瘯鏂板"));
-        }
+            TestDemo testDemo = new TestDemo();
+            testDemo.setOrderNum(-1L);
+            testDemo.setTestKey("鎵归噺鏂板");
+            testDemo.setValue("娴嬭瘯鏂板");
+            list.add(testDemo);        }
         testDemoMapper.insertBatch(list);
         for (int i = 0; i < list.size(); i++) {
             TestDemo testDemo = list.get(i);
-            testDemo.setTestKey("鎵归噺鏂板鎴栦慨鏀�").setValue("鎵归噺鏂板鎴栦慨鏀�");
+            testDemo.setTestKey("鎵归噺鏂板鎴栦慨鏀�");
+            testDemo.setValue("鎵归噺鏂板鎴栦慨鏀�");
             if (i % 2 == 0) {
                 testDemo.setId(null);
             }

--
Gitblit v1.9.3