From 5f2cd1e0d3b234230c7696d3b42b1fe7eee24259 Mon Sep 17 00:00:00 2001 From: Parker Date: Sat, 2 Jan 2021 17:32:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=88=86=E9=A1=B5=E4=B8=8D?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2count?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/base/service/impl/CrudServiceImpl.java | 15 +++++++++++++++ .../service/interfaces/CrudServiceInterface.java | 7 +++++++ .../java/org/opsli/core/persistence/Page.java | 9 ++++++++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/opsli-base-support/opsli-core/src/main/java/org/opsli/core/base/service/impl/CrudServiceImpl.java b/opsli-base-support/opsli-core/src/main/java/org/opsli/core/base/service/impl/CrudServiceImpl.java index 51c99ca..701c472 100644 --- a/opsli-base-support/opsli-core/src/main/java/org/opsli/core/base/service/impl/CrudServiceImpl.java +++ b/opsli-base-support/opsli-core/src/main/java/org/opsli/core/base/service/impl/CrudServiceImpl.java @@ -239,6 +239,21 @@ public abstract class CrudServiceImpl, T extends BaseEnt return page; } + @Override + public Page findPageNotCount(Page page) { + page.pageHelperBegin(false); + try{ + List list = this.findList(page.getQueryWrapper()); + PageInfo pageInfo = new PageInfo<>(list); + List es = transformTs2Ms(pageInfo.getList()); + page.instance(pageInfo, es); + } finally { + page.pageHelperEnd(); + } + return page; + } + + // ======================== 对象转化 ======================== /** diff --git a/opsli-base-support/opsli-core/src/main/java/org/opsli/core/base/service/interfaces/CrudServiceInterface.java b/opsli-base-support/opsli-core/src/main/java/org/opsli/core/base/service/interfaces/CrudServiceInterface.java index 4635e70..7be3ed6 100644 --- a/opsli-base-support/opsli-core/src/main/java/org/opsli/core/base/service/interfaces/CrudServiceInterface.java +++ b/opsli-base-support/opsli-core/src/main/java/org/opsli/core/base/service/interfaces/CrudServiceInterface.java @@ -192,6 +192,13 @@ public interface CrudServiceInterface */ Page findPage(Page page); + /** + * 查询分页数据 不查询 count + * + * @return Page + */ + Page findPageNotCount(Page page); + } diff --git a/opsli-base-support/opsli-core/src/main/java/org/opsli/core/persistence/Page.java b/opsli-base-support/opsli-core/src/main/java/org/opsli/core/persistence/Page.java index 399a5e6..14fcff8 100644 --- a/opsli-base-support/opsli-core/src/main/java/org/opsli/core/persistence/Page.java +++ b/opsli-base-support/opsli-core/src/main/java/org/opsli/core/persistence/Page.java @@ -74,7 +74,14 @@ public class Page extends PageSeriali * 分页函数 */ public void pageHelperBegin(){ - PageHelper.startPage(this.pageNo,this.pageSize); + this.pageHelperBegin(true); + } + + /** + * 分页函数 不统计 count + */ + public void pageHelperBegin(boolean countFlag){ + PageHelper.startPage(this.pageNo,this.pageSize, countFlag); } /**