From a346e2af25169c885c634edc6b9fa619053a50b7 Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期三, 27 九月 2023 11:49:14 +0800
Subject: [PATCH] 优化获取附近井接口分页

---
 ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java
index e6545e8..93096ba 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java
@@ -14,6 +14,7 @@
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.system.service.ISysDeptService;
 import com.ruoyi.system.service.ISysUserService;
+import com.ruoyi.utils.pagehelper.JpaPageInfo;
 import com.ruoyi.utils.result.Results;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -80,6 +81,7 @@
         List<ArdAlarmpointsWell> list = ardAlarmpointsWellService.selectArdAlarmpointsWellList(ardAlarmpointsWell);
         return success(list);
     }
+
     /**
      * 瀵煎嚭浜曠鐞嗗垪琛�
      */
@@ -127,7 +129,7 @@
     @ApiOperation("淇敼浜�")
     public AjaxResult edit(@RequestBody ArdAlarmpointsWell ardAlarmpointsWell) {
         try {
-        return toAjax(ardAlarmpointsWellService.updateArdAlarmpointsWell(ardAlarmpointsWell));
+            return toAjax(ardAlarmpointsWellService.updateArdAlarmpointsWell(ardAlarmpointsWell));
         } catch (Exception e) {
             return AjaxResult.error(e.getMessage());
         }
@@ -189,7 +191,7 @@
 
     @PostMapping("/wellList")
     @ApiOperation("鏌ヨ鏉冮檺涓嬫墍鏈夊叴瓒g偣")
-    public Results wellList(){
+    public Results wellList() {
         String usersId = SecurityUtils.getUserId();
         //鏍规嵁userId鏌ヨ閮ㄩ棬Id
         SysUser sysUser = sysUserService.selectUserById(usersId);
@@ -202,7 +204,7 @@
 
     @PostMapping("/conditionList")
     @ApiOperation("鏌ヨ骞剁瓫閫夋潈闄愪笅鎵�鏈夊叴瓒g偣")
-    public Results conditionList(ArdAlarmpointsWellParam ardAlarmpointsWellParam){
+    public Results conditionList(ArdAlarmpointsWellParam ardAlarmpointsWellParam) {
         String usersId = SecurityUtils.getUserId();
         //鏍规嵁userId鏌ヨ閮ㄩ棬Id
         SysUser sysUser = sysUserService.selectUserById(usersId);
@@ -212,13 +214,16 @@
         //鏍规嵁deptId鑾峰彇瀵瑰簲鍏磋叮鐐规暟鎹�
         return Results.succeed(ardAlarmpointsWellService.conditionList(ardAlarmpointsWellParam));
     }
+
     @PostMapping("/getNearbyWells")
     @ApiOperation("鏌ヨ闄勮繎鐨勬墍鏈変簳")
-    @ApiOperationSupport(includeParameters = {"longitude","latitude","deptId","pageNum","pageSize"})
-    public TableDataInfo getNearbyWells(ArdAlarmpointsWell ardAlarmpointsWell){
-        startPage();
-        List<ArdAlarmpointsWell> nearbyWellList = ardAlarmpointsWellService.getNearbyWellList(ardAlarmpointsWell,1000);
-        return getDataTable(nearbyWellList);
+    public AjaxResult getNearbyWells(Double[] position, Long deptId, Integer pageNum, Integer pageSize) {
+        JpaPageInfo jpaPageInfo = new JpaPageInfo();
+        jpaPageInfo.setPageNum(pageNum);
+        jpaPageInfo.setPageSize(pageSize);
+        List<ArdAlarmpointsWell> nearbyWellList = ardAlarmpointsWellService.getNearbyWellList(position, deptId, 1000);
+        jpaPageInfo.doPage(nearbyWellList);
+        return AjaxResult.success(jpaPageInfo);
     }
 
 }

--
Gitblit v1.9.3