From 3c4fee1db116c11d4f04727cfe076d7c94daeaf2 Mon Sep 17 00:00:00 2001
From: yanzhaofeige <yanzhaofeige@qq.com>
Date: Mon, 30 Sep 2024 12:10:57 +0800
Subject: [PATCH] init

---
 cpzidc-common/src/main/java/com/odcc/cpzidc/common/utils/PageUtils.java |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/cpzidc-common/src/main/java/com/odcc/cpzidc/common/utils/PageUtils.java b/cpzidc-common/src/main/java/com/odcc/cpzidc/common/utils/PageUtils.java
new file mode 100644
index 0000000..453fefd
--- /dev/null
+++ b/cpzidc-common/src/main/java/com/odcc/cpzidc/common/utils/PageUtils.java
@@ -0,0 +1,35 @@
+package com.odcc.cpzidc.common.utils;
+
+import com.github.pagehelper.PageHelper;
+import com.odcc.cpzidc.common.core.page.PageDomain;
+import com.odcc.cpzidc.common.core.page.TableSupport;
+import com.odcc.cpzidc.common.utils.sql.SqlUtil;
+
+/**
+ * 分页工具类
+ * 
+ * @author ruoyi
+ */
+public class PageUtils extends PageHelper
+{
+    /**
+     * 设置请求分页数据
+     */
+    public static void startPage()
+    {
+        PageDomain pageDomain = TableSupport.buildPageRequest();
+        Integer pageNum = pageDomain.getPageNum();
+        Integer pageSize = pageDomain.getPageSize();
+        String orderBy = SqlUtil.escapeOrderBySql(pageDomain.getOrderBy());
+        Boolean reasonable = pageDomain.getReasonable();
+        PageHelper.startPage(pageNum, pageSize, orderBy).setReasonable(reasonable);
+    }
+
+    /**
+     * 清理分页的线程变量
+     */
+    public static void clearPage()
+    {
+        PageHelper.clearPage();
+    }
+}

--
Gitblit v1.9.3