From 4f99f59668c9160ca60958b7347944def26f2228 Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期日, 27 四月 2025 10:58:53 +0800
Subject: [PATCH] 回退配置

---
 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/webUtil/QueryResultVo.java |   97 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 97 insertions(+), 0 deletions(-)

diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/webUtil/QueryResultVo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/webUtil/QueryResultVo.java
new file mode 100644
index 0000000..41344a3
--- /dev/null
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/webUtil/QueryResultVo.java
@@ -0,0 +1,97 @@
+package com.dy.common.webUtil;
+
+
+import com.alibaba.fastjson2.annotation.JSONField;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+
+import java.util.Map;
+
+@Data
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+@Schema(name = "鏌ヨ缁撴灉鍩虹被")
+public class QueryResultVo<T> {
+
+    /**
+     * 姣忛〉鏄剧ず鐨勮褰曟暟
+     */
+    @Schema(description = "姣忛〉璁板綍鏁�")
+    public Integer pageSize ;
+    /**
+     * 璁板綍鎬绘暟
+     */
+    @Schema(description = "璁板綍鎬绘暟")
+    public Long itemTotal ;
+    /**
+     * 褰撳墠椤�
+     */
+    @Schema(description = "褰撳墠椤�")
+    public Integer pageCurr ;
+    /**
+     * 鎬婚〉鏁�
+     */
+    @Schema(description = "鎬婚〉鏁�")
+    public Integer pageTotal ;
+
+    @Schema(description = "鏁版嵁")
+    public T obj;
+
+    /**
+     * 鏌ヨ寮�濮嬭褰�
+     */
+    @Schema(hidden = true)
+    @JSONField(serialize = false)
+    public Integer queryStart ;
+
+    /**
+     * 鏌ヨ鏁伴噺
+     */
+    @Schema(hidden = true)
+    @JSONField(serialize = false)
+    public Integer queryCount ;
+
+
+    public void calculateAndSet(Long itemTotal, Map<String, Object> params) {
+        this.itemTotal = itemTotal ;
+        if(this.itemTotal == null){
+            this.itemTotal = 0L ;
+        }
+
+        if(this.itemTotal == 0){
+            this.pageSize = 10 ;
+        }
+        if(this.pageSize == null || this.pageSize <= 0){
+            /**
+             * 鏈卞疂姘� 2024-01-30 淇敼
+             * 鏈紶鍏ュ垎椤靛弬鏁版椂锛屽彇鍏ㄩ儴璁板綍
+             */
+            //this.pageSize = 1 ;//渚涗笅闈綔涓洪櫎鏁�
+            this.pageSize = 10 ;//渚涗笅闈綔涓洪櫎鏁�
+        }
+
+        pageTotal = (int)Math.ceil((itemTotal==null?0.0D:itemTotal.doubleValue())/pageSize);
+
+        if (pageTotal == 0) {
+            pageTotal = 1;
+        }
+        if (pageCurr == null || pageCurr < 1) {
+            pageCurr = 1;
+        }
+        if (pageCurr > pageTotal) {
+            pageCurr = pageTotal;
+        }
+
+        //select * from table_name limit 5 锛�10;//浠庣6琛屽紑濮嬶紝妫�绱�10琛岃褰曪紝鍗筹細妫�绱㈣褰曡 6-15
+        this.queryStart = (this.pageCurr - 1) * this.pageSize ;
+        this.queryCount = this.pageSize ;
+
+        if(params != null){
+            params.put("start", this.queryStart) ;
+            params.put("count", this.queryCount) ;
+        }
+    }
+
+}

--
Gitblit v1.8.0