From fb9b8e5fb4311a10a77aa7664616f8c41534c160 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期五, 06 十月 2023 15:00:04 +0800
Subject: [PATCH] 解决查询为空报错

---
 src/main/java/com/smartearth/poiexcel/controller/EntController.java |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/smartearth/poiexcel/controller/EntController.java b/src/main/java/com/smartearth/poiexcel/controller/EntController.java
index 025ac18..2d31470 100644
--- a/src/main/java/com/smartearth/poiexcel/controller/EntController.java
+++ b/src/main/java/com/smartearth/poiexcel/controller/EntController.java
@@ -130,6 +130,28 @@
         }
     }
 
+    @ApiOperation(value = "鍒嗛〉鏌ヨ")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"),
+            @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1")
+    })
+    @GetMapping(value = "/selectByPage")
+    public ResponseMsg<Object> selectByPage(Integer pageSize, Integer pageIndex) {
+        try {
+            if (null == pageSize || pageSize < 1) {
+                pageSize = 10;
+            }
+            if (null == pageIndex || pageIndex < 1) {
+                pageIndex = 1;
+            }
+            List<EntEntity> list = qiYeMapper.selectByPage(pageSize, StaticData.I100 * (pageIndex - 1));
+
+            return success(null == list || list.isEmpty() ? 0 : list.size(), list);
+        } catch (Exception ex) {
+            return fail(ex, -1);
+        }
+    }
+
     @ApiOperation(value = "鎵归噺鏇存柊浼佷笟鍧愭爣")
     @GetMapping({"/updateCoords"})
     public ResponseMsg<Object> updateCoords() {
@@ -141,7 +163,7 @@
             }
 
             int pages = (count - 1) / StaticData.I100 + 1;
-            for (int i = 0; i < pages; i++) {
+            for (int i = 1; i <= pages; i++) {
                 List<EntEntity> list = qiYeMapper.selectByPage(StaticData.I100, StaticData.I100 * (i - 1));
                 if (null == list || list.isEmpty()) {
                     continue;

--
Gitblit v1.9.3