From 9320f400df81b506bf898d96b4e25f9f629ab485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9D=BE?= <8605635+zhang3064194730@user.noreply.gitee.com> Date: Mon, 16 Dec 2024 14:50:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=95=86=E5=93=81=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E8=B6=85=E9=99=90=E4=B8=8D=E8=BF=94=E5=9B=9E=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/cashierservice/service/ProductService.java | 5 ++++- .../system/cashierservice/util/PageHelperUtil.java | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java index 3afa48b..d7334c6 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/ProductService.java @@ -16,9 +16,11 @@ import com.chaozhanggui.system.cashierservice.mapper.MpShopUnitMapper; import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer; import com.chaozhanggui.system.cashierservice.sign.CodeEnum; import com.chaozhanggui.system.cashierservice.sign.Result; +import com.chaozhanggui.system.cashierservice.util.BeanUtil; import com.chaozhanggui.system.cashierservice.util.DateUtils; import com.chaozhanggui.system.cashierservice.util.JSONUtil; import com.chaozhanggui.system.cashierservice.util.PageHelperUtil; +import com.github.pagehelper.Page; import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -123,7 +125,7 @@ public class ProductService { public Result queryNewCommodityInfo(String shopId, String categoryId, String commdityName, String tableId, int page, int pageSize, String masterId) { List tbProductWithBLOBs=null; - PageHelperUtil.startPage(page,pageSize); + PageHelperUtil.startPage(page, pageSize); if(ObjectUtil.isEmpty(categoryId)){ tbProductWithBLOBs=tbProductMapper.selectByShopIdAndCheckGrounding(shopId,commdityName); }else { @@ -171,6 +173,7 @@ public class ProductService { }); } PageInfo pageInfo=new PageInfo(tbProductWithBLOBs); + pageInfo.setList(pageInfo.isIsLastPage() ? pageInfo.getList() : new ArrayList()); return Result.success(CodeEnum.SUCCESS,pageInfo); } diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/util/PageHelperUtil.java b/src/main/java/com/chaozhanggui/system/cashierservice/util/PageHelperUtil.java index 93fa390..7f1ae1f 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/util/PageHelperUtil.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/util/PageHelperUtil.java @@ -1,5 +1,6 @@ package com.chaozhanggui.system.cashierservice.util; +import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; public class PageHelperUtil { @@ -7,7 +8,7 @@ public class PageHelperUtil { /** * 解决页数超限 仍返回数据问题 */ - public static void startPage(int page, int pageSize) { - PageHelper.startPage(page, pageSize, true, false, false); + public static Page startPage(int page, int pageSize) { + return PageHelper.startPage(page, pageSize, true, true, false); } }