From fa2a9332b048f48be972efe02ef8b3e3334da591 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期一, 01 九月 2025 22:48:45 +0800
Subject: [PATCH] 分页处理

---
 smartor/src/main/java/com/smartor/domain/PatArchiveReq.java                          |   12 ++++++------
 smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml                       |    6 +++++-
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java |   24 ++++++++++++------------
 smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java            |    7 +++++--
 ruoyi-admin/src/main/resources/application-ls.yml                                    |    4 ++--
 5 files changed, 30 insertions(+), 23 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java
index d0f6fa1..0400c33 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/PatArchiveController.java
@@ -78,16 +78,16 @@
         return success(patArchiveService.selectPatArchiveByPatid(patid));
     }
 
-//    /**
-//     * 鏂板鎮h�呮。妗�
-//     */
-//    @ApiOperation("鏂板鎮h�呮。妗�")
-//    //@PreAuthorize("@ss.hasPermi('smartor:patarchive:add')")
-//    @Log(title = "鎮h�呮。妗�", businessType = BusinessType.INSERT)
-//    @PostMapping("/add")
-//    public AjaxResult add(@RequestBody PatArchive patArchive) {
-//        return toAjax(patArchiveService.insertPatArchive(patArchive));
-//    }
+    /**
+     * 鏂板鎮h�呮。妗�
+     */
+    @ApiOperation("鏂板鎮h�呮。妗�")
+    //@PreAuthorize("@ss.hasPermi('smartor:patarchive:add')")
+    @Log(title = "鎮h�呮。妗�", businessType = BusinessType.INSERT)
+    @PostMapping("/add")
+    public AjaxResult add(@RequestBody PatArchive patArchive) {
+        return toAjax(patArchiveService.insertPatArchive(patArchive));
+    }
 
     /**
      * 鏂板鎮h�呮。妗�
@@ -189,8 +189,8 @@
         long count = PageUtils.count(new ISelect() {
             @Override
             public void doSelect() {
-                patArchive.setPageNum(null);
-                patArchive.setPageSize(null);
+                patArchive.setPn(null);
+                patArchive.setPs(null);
                 patArchiveService.patInfoByContion(patArchive);
             }
         });
diff --git a/ruoyi-admin/src/main/resources/application-ls.yml b/ruoyi-admin/src/main/resources/application-ls.yml
index 788a0fc..cde7fa2 100644
--- a/ruoyi-admin/src/main/resources/application-ls.yml
+++ b/ruoyi-admin/src/main/resources/application-ls.yml
@@ -11,7 +11,7 @@
         #        username: smartor
         #        password: Smartor.2023
         #        driverClassName: com.mysql.cj.jdbc.Driver
-        url: jdbc:mysql://9.208.7.13:2883/smartor-lisui?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
+        url: jdbc:mysql://9.208.7.13:2883/smartor-lisui?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
         username: root@sfxx#other_cluster
         password: Y5oapyS8
         driverClassName: com.mysql.cj.jdbc.Driver
@@ -111,7 +111,7 @@
 pagehelper:
   helperDialect: mysql
   supportMethodsArguments: true
-  params: count=countSql
+#  params: countSql;pageSizeZero=true
 
 magic-api:
   web: /magic/web
diff --git a/smartor/src/main/java/com/smartor/domain/PatArchiveReq.java b/smartor/src/main/java/com/smartor/domain/PatArchiveReq.java
index df59fec..b9eed5b 100644
--- a/smartor/src/main/java/com/smartor/domain/PatArchiveReq.java
+++ b/smartor/src/main/java/com/smartor/domain/PatArchiveReq.java
@@ -164,16 +164,16 @@
     /**
      * pageNum
      */
-    @ApiModelProperty(value = "pageNum")
-    @Excel(name = "pageNum")
-    private Integer pageNum;
+    @ApiModelProperty(value = "pn")
+    @Excel(name = "pn")
+    private Integer pn;
 
     /**
      * pageSize
      */
-    @ApiModelProperty(value = "pageSize")
-    @Excel(name = "pageSize")
-    private Integer pageSize;
+    @ApiModelProperty(value = "ps")
+    @Excel(name = "ps")
+    private Integer ps;
 
 
     /**
diff --git a/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java b/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java
index 3d1cb8f..12dc318 100644
--- a/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java
+++ b/smartor/src/main/java/com/smartor/service/impl/PatArchiveServiceImpl.java
@@ -565,8 +565,11 @@
     @Override
     public List<PatArchive> patInfoByContion(PatArchiveReq patArchive) {
         List<PatArchive> patArchives = new ArrayList<>();
-        if(ObjectUtils.isNotEmpty(patArchive.getPageNum())){
-            patArchive.setPageNum(patArchive.getPageNum()*patArchive.getPageSize()-patArchive.getPageNum());
+        if (ObjectUtils.isNotEmpty(patArchive.getPageNum()) && ObjectUtils.isNotEmpty(patArchive.getPageSize())) {
+            patArchive.setPn(patArchive.getPageNum() * patArchive.getPageSize() - patArchive.getPageNum());
+            patArchive.setPs(patArchive.getPageSize());
+            patArchive.setPageNum(null);
+            patArchive.setPageSize(null);
         }
         //鏍规嵁鏉′欢鑾峰彇鎮h�呬俊鎭�
 //        List<PatArchive> patArchiveList = patArchiveMapper.patInfoByContion(patArchive);
diff --git a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
index 009a676..ce7292e 100644
--- a/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
+++ b/smartor/src/main/resources/mapper/smartor/PatArchiveMapper.xml
@@ -519,7 +519,7 @@
             </if>
         </where>
         order by a.update_time desc
-        <if test="pageSize != null  and pageSize != ''"> limit ${pageNum},${pageSize} </if>
+        <if test="pn != null  and ps != null"> limit ${pn},${ps} </if>
 
     </select>
 
@@ -661,6 +661,7 @@
             </if>
         </where>
         order by a.update_time desc
+        <if test="pn != null  and ps != null"> limit ${pn},${ps} </if>
     </select>
 
     <select id="selectPatArchiveInfoByOuthosp" parameterType="com.smartor.domain.PatArchiveReq"
@@ -751,6 +752,7 @@
             </if>
         </where>
         order by a.update_time desc
+        <if test="pn != null  and ps != null"> limit ${pn},${ps} </if>
     </select>
 
     <select id="selectPatArchiveInfoByPhysical" parameterType="com.smartor.domain.PatArchiveReq"
@@ -843,6 +845,7 @@
             </if>
         </where>
         order by a.update_time desc
+        <if test="pn != null  and ps != null"> limit ${pn},${ps} </if>
     </select>
 
     <select id="selectPatArchiveInfoByInhospQC" parameterType="com.smartor.domain.PatArchiveReq"
@@ -987,6 +990,7 @@
             </if>
         </where>
         order by a.id,a.update_time desc ) as tmp order by endtime desc
+        <if test="pn != null  and ps != null"> limit ${pn},${ps} </if>
     </select>
 
     <select id="selectPatArchiveInfoByOuthospQC" parameterType="com.smartor.domain.PatArchiveReq"

--
Gitblit v1.9.3