fix: 商品列表超限不返回数量修复
This commit is contained in:
parent
89e202fa15
commit
9320f400df
|
|
@ -16,9 +16,11 @@ import com.chaozhanggui.system.cashierservice.mapper.MpShopUnitMapper;
|
||||||
import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
|
import com.chaozhanggui.system.cashierservice.rabbit.RabbitProducer;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||||
import com.chaozhanggui.system.cashierservice.sign.Result;
|
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.DateUtils;
|
||||||
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
||||||
import com.chaozhanggui.system.cashierservice.util.PageHelperUtil;
|
import com.chaozhanggui.system.cashierservice.util.PageHelperUtil;
|
||||||
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
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) {
|
public Result queryNewCommodityInfo(String shopId, String categoryId, String commdityName, String tableId, int page, int pageSize, String masterId) {
|
||||||
List<TbProduct> tbProductWithBLOBs=null;
|
List<TbProduct> tbProductWithBLOBs=null;
|
||||||
|
|
||||||
PageHelperUtil.startPage(page,pageSize);
|
PageHelperUtil.startPage(page, pageSize);
|
||||||
if(ObjectUtil.isEmpty(categoryId)){
|
if(ObjectUtil.isEmpty(categoryId)){
|
||||||
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndCheckGrounding(shopId,commdityName);
|
tbProductWithBLOBs=tbProductMapper.selectByShopIdAndCheckGrounding(shopId,commdityName);
|
||||||
}else {
|
}else {
|
||||||
|
|
@ -171,6 +173,7 @@ public class ProductService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
PageInfo pageInfo=new PageInfo(tbProductWithBLOBs);
|
PageInfo pageInfo=new PageInfo(tbProductWithBLOBs);
|
||||||
|
pageInfo.setList(pageInfo.isIsLastPage() ? pageInfo.getList() : new ArrayList());
|
||||||
return Result.success(CodeEnum.SUCCESS,pageInfo);
|
return Result.success(CodeEnum.SUCCESS,pageInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.chaozhanggui.system.cashierservice.util;
|
package com.chaozhanggui.system.cashierservice.util;
|
||||||
|
|
||||||
|
import com.github.pagehelper.Page;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
|
|
||||||
public class PageHelperUtil {
|
public class PageHelperUtil {
|
||||||
|
|
@ -7,7 +8,7 @@ public class PageHelperUtil {
|
||||||
/**
|
/**
|
||||||
* 解决页数超限 仍返回数据问题
|
* 解决页数超限 仍返回数据问题
|
||||||
*/
|
*/
|
||||||
public static void startPage(int page, int pageSize) {
|
public static Page<Object> startPage(int page, int pageSize) {
|
||||||
PageHelper.startPage(page, pageSize, true, false, false);
|
return PageHelper.startPage(page, pageSize, true, true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue