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/service/IArdAlarmpointsWellService.java | 2 +-
ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java | 8 +++++---
ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java | 21 +++++++++++++--------
3 files changed, 19 insertions(+), 12 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);
}
}
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java
index 364225f..6e41484 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/IArdAlarmpointsWellService.java
@@ -122,5 +122,5 @@
* 鍒樿嫃涔�
* 2023/9/27 10:26:35
*/
- List<ArdAlarmpointsWell> getNearbyWellList(ArdAlarmpointsWell ardAlarmpointsWell,Integer range);
+ List<ArdAlarmpointsWell> getNearbyWellList(Double[] position, Long deptId,Integer range);
}
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
index 89acfd4..6843b20 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
@@ -296,12 +296,14 @@
}
@Override
- public List<ArdAlarmpointsWell> getNearbyWellList(ArdAlarmpointsWell ardAlarmpointsWell, Integer range) {
+ public List<ArdAlarmpointsWell> getNearbyWellList(Double[] position, Long deptId, Integer range) {
List<ArdAlarmpointsWell> nearbyWellList = new ArrayList<>();
try {
- Double longitudeCenter = ardAlarmpointsWell.getLongitude();
- Double latitudeCenter = ardAlarmpointsWell.getLatitude();
+ Double longitudeCenter = position[0];
+ Double latitudeCenter = position[1];
if (longitudeCenter != null && latitudeCenter != null) {
+ ArdAlarmpointsWell ardAlarmpointsWell=new ArdAlarmpointsWell();
+ ardAlarmpointsWell.setDeptId(deptId);
List<ArdAlarmpointsWell> ardAlarmpointsWells = ardAlarmpointsWellMapper.selectArdAlarmpointsWellList(ardAlarmpointsWell);
if (ardAlarmpointsWells.size() > 0) {
for (ArdAlarmpointsWell well : ardAlarmpointsWells) {
--
Gitblit v1.9.3