From f65443d8abeaedc9d102324565e8368e7c9d90c8 Mon Sep 17 00:00:00 2001
From: 郑永安 <zyazyz250@sina.com>
Date: Mon, 19 Jun 2023 14:41:54 +0800
Subject: [PATCH] commit
---
src/main/java/com/gk/firework/Domain/Utils/PageInfo.java | 143 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 143 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/gk/firework/Domain/Utils/PageInfo.java b/src/main/java/com/gk/firework/Domain/Utils/PageInfo.java
new file mode 100644
index 0000000..be8950a
--- /dev/null
+++ b/src/main/java/com/gk/firework/Domain/Utils/PageInfo.java
@@ -0,0 +1,143 @@
+package com.gk.firework.Domain.Utils;
+
+import java.util.List;
+import java.util.Map;
+
+public class PageInfo {
+ private final static int PAGESIZE = 10; //默认显示的记录数
+
+ private List result;
+
+ private Long totalCount;
+
+ private Integer pageSize;
+
+ private Integer pageIndex;
+
+ private String sort;
+
+ private String order;
+
+ private int from;
+
+ private int size;
+
+ private Map<String, Object> condition; //查询条件
+
+ public PageInfo() {}
+
+ //构造方法
+ public PageInfo(int pageIndex, int pageSize) {
+ //计算当前页
+ if (pageIndex < 0) {
+ this.pageIndex = 1;
+ } else {
+ //当前页
+ this.pageIndex = pageIndex;
+ }
+ //记录每页显示的记录数
+ if (pageSize < 0) {
+ this.pageSize = PAGESIZE;
+ } else {
+ this.pageSize = pageSize;
+ }
+ //计算开始的记录和结束的记录
+ this.from = (this.pageIndex - 1) * this.pageSize;
+ this.size = this.pageSize;
+ }
+
+ // 构造方法
+ public PageInfo(int pageIndex, int pageSize, String sort, String order) {
+ // 计算当前页
+ if (pageIndex < 0) {
+ this.pageIndex = 1;
+ } else {
+ // 当前页
+ this.pageIndex = pageIndex;
+ }
+ // 记录每页显示的记录数
+ if (pageSize < 0) {
+ this.pageSize = PAGESIZE;
+ } else {
+ this.pageSize = pageSize;
+ }
+ // 计算开始的记录和结束的记录
+ this.from = (this.pageIndex - 1) * this.pageSize;
+ this.size = this.pageSize;
+ // 排序字段,正序还是反序
+ this.sort = sort;
+ this.order = order;
+ }
+
+ public List getResult() {
+ return result;
+ }
+
+ public void setResult(List result) {
+ this.result = result;
+ }
+
+ public Long getTotalCount() {
+ return totalCount;
+ }
+
+ public void setTotalCount(Long totalCount) {
+ this.totalCount = totalCount;
+ }
+
+ public Integer getPageSize() {
+ return pageSize;
+ }
+
+ public void setPageSize(Integer pageSize) {
+ this.pageSize = pageSize;
+ }
+
+ public Integer getPageIndex() {
+ return pageIndex;
+ }
+
+ public void setPageIndex(Integer pageIndex) {
+ this.pageIndex = pageIndex;
+ }
+
+ public String getSort() {
+ return sort;
+ }
+
+ public void setSort(String sort) {
+ this.sort = sort;
+ }
+
+ public String getOrder() {
+ return order;
+ }
+
+ public void setOrder(String order) {
+ this.order = order;
+ }
+
+ public int getFrom() {
+ return from;
+ }
+
+ public void setFrom(int from) {
+ this.from = from;
+ }
+
+ public int getSize() {
+ return size;
+ }
+
+ public void setSize(int size) {
+ this.size = size;
+ }
+
+ public Map<String, Object> getCondition() {
+ return condition;
+ }
+
+ public void setCondition(Map<String, Object> condition) {
+ this.condition = condition;
+ }
+}
--
Gitblit v1.9.2