From 935850110f48206e38dc7acd21f05fdc6a958cf3 Mon Sep 17 00:00:00 2001 From: liusuyi <1951119284@qq.com> Date: 星期日, 28 四月 2024 15:55:15 +0800 Subject: [PATCH] 优化 --- ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml | 34 ++++++++++++++++++++++++++++++---- 1 files changed, 30 insertions(+), 4 deletions(-) diff --git a/ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml b/ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml index 5d4b794..97f4d7d 100644 --- a/ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml +++ b/ard-work/src/main/resources/mapper/alarmpoints/ArdAlarmpointsWellMapper.xml @@ -300,13 +300,39 @@ </select> - <select id="conditionList" parameterType="List" - resultType="com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWellDeptVo"> + <select id="conditionList" resultType="com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell"> Select * from ard_alarmpoints_well well where WHERE well.well_id = #{wellId} and well.dept_id in - <foreach collection="list" index="index" item="item" open="(" separator="," close=")"> - #{item} + <foreach item="deptList" collection="deptList" open="(" separator="," close=")"> + #{deptList} </foreach> </select> + + <select id="getArdAlarmpointsWellByDeptIdAndDistance" resultMap="ArdAlarmpointsWellOnlyResult"> + /*select * from ard_alarmpoints_well aaw + where aaw.dept_id in ( + with recursive rsd as ( + select sd.dept_id from sys_dept sd where sd.dept_id = #{deptId} + union + select csd.dept_id from sys_dept csd inner join rsd on rsd.dept_id = csd.parent_id + ) + select * from rsd)*/ + select * from ard_alarmpoints_well aaw + where aaw.dept_id in ( + with recursive rsd as ( + select sd.dept_id from sys_dept sd where sd.dept_id = #{deptId} + union + select csd.dept_id from sys_dept csd inner join rsd on rsd.dept_id = csd.parent_id + ) + select * from rsd) and f_compute_distance(aaw.longitude,aaw.latitude,#{lonM},#{latM}) <= (select max(t.distance) from ( + select f_compute_distance(#{lonM},#{latM},#{lonA},#{latA}) as distance + union + select f_compute_distance(#{lonM},#{latM},#{lonB},#{latB}) as distance + union + select f_compute_distance(#{lonM},#{latM},#{lonC,#{latC}) as distance + union + select f_compute_distance(#{lonM},#{latM},#{lonD},#{latD}) as distance + )t) + </select> </mapper> -- Gitblit v1.9.3