From dde409e8afa489a028dbef4c55c9b55ecc0f5696 Mon Sep 17 00:00:00 2001 From: chen <1216142052@qq.com> Date: Sat, 24 Sep 2022 11:30:14 +0800 Subject: [PATCH] =?UTF-8?q?2022-09-24=20=E6=9B=B4=E6=96=B0=E5=88=86?= =?UTF-8?q?=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ZyStyleFabricController.java | 23 ++++--------------- .../controller/ZyStyleModuleController.java | 23 ++++--------------- 2 files changed, 8 insertions(+), 38 deletions(-) diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zystylefabric/controller/ZyStyleFabricController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zystylefabric/controller/ZyStyleFabricController.java index c5438e22..7bccec09 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zystylefabric/controller/ZyStyleFabricController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zystylefabric/controller/ZyStyleFabricController.java @@ -31,6 +31,7 @@ import org.jeecg.modules.zystylefabric.entity.NewZyStyleFabric; import org.jeecg.modules.zystylefabric.entity.ZyStyleFabric; import org.jeecg.modules.zystylefabric.service.INewZyStyleFabricService; import org.jeecg.modules.zystylefabric.service.IZyStyleFabricService; +import org.jeecg.modules.zystylemodel.entity.ZyStyleModel; import org.jeecg.modules.zystylemodule.entity.NewStyleModule; import org.jeecg.modules.zystylemodule.entity.ZyStyleModule; import org.jeecgframework.poi.excel.ExcelImportUtil; @@ -118,25 +119,9 @@ public class ZyStyleFabricController extends JeecgController size && size!=0) { - pageSize = size; - } - // 求出最大页数,防止currentPage越界 - int maxPage = size % pageSize == 0 ? size / pageSize : size / pageSize + 1; - if (pageNo > maxPage) { - pageNo = maxPage; - } - // 当前页第一条数据的下标 - int curIdx = pageNo > 1 ? (pageNo - 1) * pageSize : 0; - List pageList = new ArrayList(); - // 将当前页的数据放进pageList - for (int i = 0; i < pageSize && curIdx + i < size; i++) { - pageList.add(newZyStyleFabrics.get(curIdx + i)); - } - page.setCurrent(pageNo).setSize(pageSize).setTotal(newZyStyleFabrics.size()).setRecords(pageList); - return Result.OK(page); + IPage pageList = new Page<>(pageNo, pageSize, list.size()); + pageList.setRecords(newZyStyleFabrics); + return Result.OK(pageList); } /** diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zystylemodule/controller/ZyStyleModuleController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zystylemodule/controller/ZyStyleModuleController.java index 60bfc656..1f7cf642 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zystylemodule/controller/ZyStyleModuleController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zystylemodule/controller/ZyStyleModuleController.java @@ -25,6 +25,7 @@ import org.jeecg.modules.demo.base.service.IZyClothsModularService; import org.jeecg.modules.demo.base.service.IZyClothsTypeService; import org.jeecg.modules.zyclothsstyle.entity.ZyClothsStyle; import org.jeecg.modules.zyclothsstyle.service.IZyClothsStyleService; +import org.jeecg.modules.zystylefabric.entity.NewZyStyleFabric; import org.jeecg.modules.zystylemodule.entity.NewStyleModule; import org.jeecg.modules.zystylemodule.entity.ZyStyleModule; import org.jeecg.modules.zystylemodule.service.INewZyStyleModuleService; @@ -121,25 +122,9 @@ public class ZyStyleModuleController extends JeecgController size && size!=0) { - pageSize = size; - } - // 求出最大页数,防止currentPage越界 - int maxPage = size % pageSize == 0 ? size / pageSize : size / pageSize + 1; - if (pageNo > maxPage) { - pageNo = maxPage; - } - // 当前页第一条数据的下标 - int curIdx = pageNo > 1 ? (pageNo - 1) * pageSize : 0; - List pageList = new ArrayList(); - // 将当前页的数据放进pageList - for (int i = 0; i < pageSize && curIdx + i < size; i++) { - pageList.add(listNewStyleModules.get(curIdx + i)); - } - page.setCurrent(pageNo).setSize(pageSize).setTotal(listNewStyleModules.size()).setRecords(pageList); - return Result.OK(page); + IPage pageList = new Page<>(pageNo, pageSize, list.size()); + pageList.setRecords(listNewStyleModules); + return Result.OK(pageList); } /** * 分页列表查询