From 74756c657109a4e48dd6c0b4d8959cdab89b33a9 Mon Sep 17 00:00:00 2001
From: xiebin <vip_xiaobin810@163.com>
Date: Wed, 28 Jan 2026 20:10:29 +0800
Subject: [PATCH] update-区域划分表结构调整
---
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwAreaDivideMapper.xml | 113 ++++++++++++++++++++++++++++++++++----------------------
1 files changed, 69 insertions(+), 44 deletions(-)
diff --git a/drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwAreaDivideMapper.xml b/drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwAreaDivideMapper.xml
index da5d2e1..f73938e 100644
--- a/drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwAreaDivideMapper.xml
+++ b/drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwAreaDivideMapper.xml
@@ -46,37 +46,39 @@
<select id="selectFwAreaDividePage" resultMap="fwAreaDivideResultMap">
select
- ad.id,
- ad.area_name,
- ad.longitude,
- ad.latitude,
- ad.area_size,
- case
- when ad.geom is null then null
- when ST_SRID(ad.geom) is null or ST_SRID(ad.geom) = 0 then ST_AsText(ad.geom)
- else concat(ST_AsText(ST_SwapXY(ad.geom)), ' | ', ST_SRID(ad.geom))
- end as geom,
- ad.area_type,
- ad.trigger_condition,
- ad.response_mechanism,
- ad.control_level,
- ad.police_station_id,
- ad.device_ids,
- ad.fly_date_start,
- ad.fly_date_end,
- ad.area_code,
- ps.station_name as police_station_name,
- ad.create_user,
- ad.create_dept,
- ad.create_time,
- ad.update_user,
- ad.update_time,
- ad.status,
- ad.is_deleted
- from ja_fw_area_divide ad
- left join ja_fw_police_station ps on ps.id = ad.police_station_id and ps.is_deleted = 0
+ ad.id,
+ ad.area_name,
+ ad.longitude,
+ ad.latitude,
+ ad.area_size,
+ case
+ when ad.geom is null then null
+ when ST_SRID(ad.geom) is null or ST_SRID(ad.geom) = 0 then ST_AsText(ad.geom)
+ else concat(ST_AsText(ST_SwapXY(ad.geom)), ' | ', ST_SRID(ad.geom))
+ end as geom,
+ ad.area_type,
+ ad.trigger_condition,
+ ad.response_mechanism,
+ ad.control_level,
+ ad.police_station_id,
+ ad.device_ids,
+ ad.fly_date_start,
+ ad.fly_date_end,
+ ad.area_code,
+ ps.station_name as police_station_name,
+ ad.create_user,
+ ad.create_dept,
+ ad.create_time,
+ ad.update_user,
+ ad.update_time,
+ ad.status,
+ ad.is_deleted
+ from
+ ja_fw_area_divide ad
+ left join
+ ja_fw_police_station ps on ps.id = ad.police_station_id and ps.is_deleted = 0
<where>
- ad.is_deleted = 0
+ ad.is_deleted = 0
<if test="param2.id != null and param2.id != ''">
and ad.id = #{param2.id}
</if>
@@ -118,6 +120,12 @@
</if>
<if test="param2.areaCode != null and param2.areaCode != ''">
and ad.area_code = #{param2.areaCode}
+ </if>
+ <if test="param2.deptList != null and param2.deptList.size > 0">
+ and ad.create_dept in
+ <foreach collection="param2.deptList" item="deptId" open="(" separator="," close=")">
+ #{deptId}
+ </foreach>
</if>
</where>
</select>
@@ -232,6 +240,17 @@
</where>
</select>
+ <select id="selectAreaCountByDeviceId" resultType="java.lang.Integer">
+ select count(1)
+ from ja_fw_area_divide ad
+ <where>
+ ad.is_deleted = 0
+ and ad.device_ids is not null
+ and ad.device_ids != ''
+ and find_in_set(#{deviceId}, replace(ad.device_ids, ' ', ''))
+ </where>
+ </select>
+
<select id="selectFwAreaDivideDetail" resultMap="fwAreaDivideResultMap">
select
ad.id,
@@ -271,21 +290,21 @@
<select id="selectFwAreaDivideStatisticsPage" resultMap="fwAreaDivideStatisticsResultMap">
select
- stats.id,
- stats.area_name,
- stats.area_type,
- stats.scene_name,
- stats.scene_type,
- stats.device_count,
- stats.alarm_count,
- stats.counter_count,
- stats.counter_success_count,
- case
- when stats.counter_count = 0 then '/'
- when stats.counter_success_count * 100.0 / stats.counter_count >= 80 then '好'
- when stats.counter_success_count * 100.0 / stats.counter_count >= 60 then '一般'
+ stats.id,
+ stats.area_name,
+ stats.area_type,
+ stats.scene_name,
+ stats.scene_type,
+ stats.device_count,
+ stats.alarm_count,
+ stats.counter_count,
+ stats.counter_success_count,
+ case
+ when stats.counter_count = 0 then '/'
+ when stats.counter_success_count * 100.0 / stats.counter_count >= 80 then '好'
+ when stats.counter_success_count * 100.0 / stats.counter_count >= 60 then '一般'
else '差'
- end as control_effect
+ end as control_effect
from (
select
ad.id,
@@ -362,6 +381,12 @@
<if test="param2.areaCode != null and param2.areaCode != ''">
and ad.area_code = #{param2.areaCode}
</if>
+ <if test="param2.deptList != null and param2.deptList.size > 0">
+ and ad.create_dept in
+ <foreach collection="param2.deptList" item="deptId" open="(" separator="," close=")">
+ #{deptId}
+ </foreach>
+ </if>
</where>
) stats
</select>
--
Gitblit v1.9.3