From 1bfbc52da47b22f00a1c1f5f670c30f70d999873 Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Mon, 02 Feb 2026 18:18:09 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwAreaDivideMapper.xml | 510 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 507 insertions(+), 3 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 7b280a4..6493925 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
@@ -3,17 +3,521 @@
<mapper namespace="org.sxkj.fw.area.mapper.FwAreaDivideMapper">
<!-- 通用查询映射结果 -->
- <resultMap id="fwAreaDivideResultMap" type="org.sxkj.fw.area.entity.FwAreaDivideEntity">
+ <resultMap id="fwAreaDivideResultMap" type="org.sxkj.fw.area.vo.FwAreaDivideVO">
+ <result column="id" property="id"/>
+ <result column="area_name" property="areaName"/>
+ <result column="trigger_condition" property="triggerCondition"/>
+ <result column="response_mechanism" property="responseMechanism"/>
+ <result column="control_level" property="controlLevel"/>
+ <result column="police_station_id" property="policeStationId"/>
+ <result column="device_ids" property="deviceIds"/>
+ <result column="fly_date_start" property="flyDateStart"/>
+ <result column="fly_date_end" property="flyDateEnd"/>
+ <result column="area_code" property="areaCode"/>
+ <result column="area_type_keys" property="areaTypeKeys"/>
+ <result column="police_station_name" property="policeStationName"/>
+ <result column="police_station_contact_person" property="policeStationContactPerson"/>
+ <result column="police_station_contact_phone" property="policeStationContactPhone"/>
+ </resultMap>
+
+ <resultMap id="fwAreaDivideStatisticsResultMap" type="org.sxkj.fw.area.vo.FwAreaDivideStatisticsVO">
+ <result column="id" property="id"/>
+ <result column="area_name" property="areaName"/>
+ <result column="area_type_keys" property="areaTypeKeys"/>
+ <result column="scene_name" property="sceneName"/>
+ <result column="scene_type" property="sceneType"/>
+ <result column="device_count" property="deviceCount"/>
+ <result column="alarm_count" property="alarmCount"/>
+ <result column="counter_count" property="counterCount"/>
+ <result column="counter_success_count" property="counterSuccessCount"/>
+ <result column="control_effect" property="controlEffect"/>
</resultMap>
<select id="selectFwAreaDividePage" resultMap="fwAreaDivideResultMap">
- select * from ja_fw_area_divide where is_deleted = 0
+ select
+ ad.*,
+ ps.station_name as police_station_name,
+ ps.contact_person as police_station_contact_person,
+ ps.contact_phone as police_station_contact_phone
+ 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
+ <if test="param2.id != null and param2.id != ''">
+ and ad.id = #{param2.id}
+ </if>
+ <if test="param2.areaName != null and param2.areaName != ''">
+ and ad.area_name like concat('%', #{param2.areaName}, '%')
+ </if>
+ <if test="param2.triggerCondition != null and param2.triggerCondition != ''">
+ and ad.trigger_condition = #{param2.triggerCondition}
+ </if>
+ <if test="param2.responseMechanism != null and param2.responseMechanism != ''">
+ and ad.response_mechanism = #{param2.responseMechanism}
+ </if>
+ <if test="param2.controlLevel != null and param2.controlLevel != ''">
+ and ad.control_level = #{param2.controlLevel}
+ </if>
+ <if test="param2.policeStationId != null and param2.policeStationId != ''">
+ and ad.police_station_id = #{param2.policeStationId}
+ </if>
+ <if test="param2.deviceIds != null and param2.deviceIds != ''">
+ and ad.device_ids = #{param2.deviceIds}
+ </if>
+ <if test="param2.flyDateStart != null and param2.flyDateStart != ''">
+ and ad.fly_date_start >= #{param2.flyDateStart}
+ </if>
+ <if test="param2.flyDateEnd != null and param2.flyDateEnd != ''">
+ and ad.fly_date_end <= #{param2.flyDateEnd}
+ </if>
+ <if test="param2.areaCode != null and param2.areaCode != ''">
+ and ad.area_code = #{param2.areaCode}
+ </if>
+ <if test="param2.areaTypeKeyList != null and param2.areaTypeKeyList.size > 0">
+ and (
+ <foreach collection="param2.areaTypeKeyList" item="key" separator=" or ">
+ find_in_set(#{key}, ad.area_type_keys)
+ </foreach>
+ )
+ </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>
+
+ <select id="selectFwAreaDivideList" resultMap="fwAreaDivideResultMap">
+ select
+ ad.*,
+ ps.station_name as police_station_name,
+ ps.contact_person as police_station_contact_person,
+ ps.contact_phone as police_station_contact_phone
+ 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
+ <if test="isSetSceneManage != null and isSetSceneManage == 1">
+ and exists (
+ select 1
+ from ja_fw_defense_scene ds
+ join ja_fw_defense_scene_manage dsm on dsm.defense_scene_id = ds.id and dsm.is_deleted = 0
+ where ds.is_deleted = 0
+ and ds.area_divide_ids is not null
+ and ds.area_divide_ids != ''
+ and find_in_set(ad.id, replace(ds.area_divide_ids, ' ', ''))
+ )
+ </if>
+ <if test="isSetSceneManage != null and isSetSceneManage == 1 and flyTime != null">
+ and exists (
+ select 1
+ from ja_fw_defense_scene ds
+ join ja_fw_defense_scene_manage dsm on dsm.defense_scene_id = ds.id and dsm.is_deleted = 0
+ where ds.is_deleted = 0
+ and ds.area_divide_ids is not null
+ and ds.area_divide_ids != ''
+ and find_in_set(ad.id, replace(ds.area_divide_ids, ' ', ''))
+ and (dsm.effective_date_start is null or dsm.effective_date_start <= #{flyTime})
+ and (dsm.effective_date_end is null or dsm.effective_date_end >= #{flyTime})
+ )
+ </if>
+ <if test="filterSelected != null and filterSelected == 1">
+ and (
+ not exists (
+ select 1
+ from ja_fw_defense_scene ds
+ where ds.is_deleted = 0
+ and ds.area_divide_ids is not null
+ and ds.area_divide_ids != ''
+ and find_in_set(ad.id, replace(ds.area_divide_ids, ' ', ''))
+ )
+ <if test="sceneId != null">
+ or exists (
+ select 1
+ from ja_fw_defense_scene ds
+ where ds.is_deleted = 0
+ and ds.id = #{sceneId}
+ and ds.area_divide_ids is not null
+ and ds.area_divide_ids != ''
+ and find_in_set(ad.id, replace(ds.area_divide_ids, ' ', ''))
+ )
+ </if>
+ )
+ </if>
+ <if test="sceneId != null and (filterSelected == null or filterSelected != 1)">
+ and exists (
+ select 1
+ from ja_fw_defense_scene ds
+ where ds.is_deleted = 0
+ and ds.id = #{sceneId}
+ and ds.area_divide_ids is not null
+ and ds.area_divide_ids != ''
+ and find_in_set(ad.id, replace(ds.area_divide_ids, ' ', ''))
+ )
+ </if>
+ <if test="areaTypeKeyList != null and areaTypeKeyList.size > 0">
+ and (
+ <foreach collection="areaTypeKeyList" item="key" separator=" or ">
+ find_in_set(#{key}, ad.area_type_keys)
+ </foreach>
+ )
+ </if>
+ </where>
+ </select>
+
+ <select id="selectFwAreaDivideListByDeviceIds" resultMap="fwAreaDivideResultMap">
+ select
+ ad.id,
+ ad.area_name,
+ ad.device_ids
+ from ja_fw_area_divide ad
+ <where>
+ ad.is_deleted = 0
+ and ad.device_ids is not null
+ and ad.device_ids != ''
+ <if test="deviceIds != null and deviceIds.size > 0">
+ and (
+ <foreach collection="deviceIds" item="deviceId" separator=" or ">
+ find_in_set(#{deviceId}, replace(ad.device_ids, ' ', ''))
+ </foreach>
+ )
+ </if>
+ </where>
+ </select>
+
+ <select id="selectFwDefenseSceneListByAreaIds" resultType="org.sxkj.fw.area.vo.FwDefenseSceneVO">
+ select
+ ds.id,
+ ds.scene_name as sceneName,
+ ds.area_divide_ids as areaDivideIds
+ from ja_fw_defense_scene ds
+ <where>
+ ds.is_deleted = 0
+ and ds.area_divide_ids is not null
+ and ds.area_divide_ids != ''
+ <if test="areaIds != null and areaIds.size > 0">
+ and (
+ <foreach collection="areaIds" item="areaId" separator=" or ">
+ find_in_set(#{areaId}, replace(ds.area_divide_ids, ' ', ''))
+ </foreach>
+ )
+ </if>
+ </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.*,
+ ps.station_name as police_station_name,
+ ps.contact_person as police_station_contact_person,
+ ps.contact_phone as police_station_contact_phone
+ 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
+ and ad.id = #{id}
+ </select>
+
+ <select id="selectFwAreaDivideStatisticsPage" resultMap="fwAreaDivideStatisticsResultMap">
+ select
+ stats.id,
+ stats.area_name,
+ stats.area_type_keys,
+ 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
+ from (
+ select
+ ad.id,
+ ad.area_name,
+ ad.area_type_keys,
+ (
+ select group_concat(distinct ds.scene_name)
+ from ja_fw_defense_scene ds
+ join ja_fw_defense_scene_manage dsm on dsm.defense_scene_id = ds.id and dsm.is_deleted = 0
+ where ds.is_deleted = 0
+ and find_in_set(ad.id, ds.area_divide_ids)
+ ) as scene_name,
+ (
+ select group_concat(distinct ds.scene_type)
+ from ja_fw_defense_scene ds
+ join ja_fw_defense_scene_manage dsm on dsm.defense_scene_id = ds.id and dsm.is_deleted = 0
+ where ds.is_deleted = 0
+ and find_in_set(ad.id, ds.area_divide_ids)
+ ) as scene_type,
+ case
+ when ad.device_ids is null or trim(ad.device_ids) = '' then 0
+ else length(replace(ad.device_ids, ' ', '')) - length(replace(replace(ad.device_ids, ' ', ''), ',', '')) + 1
+ end as device_count,
+ case
+ when ad.device_ids is null or trim(ad.device_ids) = '' then 0
+ else (
+ select count(1)
+ from ja_fw_drone_alarm_record ar
+ join ja_fw_device d on d.id = ar.device_id and d.is_deleted = 0
+ where ar.is_deleted = 0
+ and find_in_set(d.id, replace(ad.device_ids, ' ', ''))
+ )
+ end as alarm_count,
+ case
+ when ad.device_ids is null or trim(ad.device_ids) = '' then 0
+ else (
+ select count(1)
+ from ja_fw_effect_eval ee
+ join ja_fw_device d on d.id = ee.device_id and d.is_deleted = 0
+ where ee.is_deleted = 0
+ and find_in_set(d.id, replace(ad.device_ids, ' ', ''))
+ )
+ end as counter_count,
+ case
+ when ad.device_ids is null or trim(ad.device_ids) = '' then 0
+ else (
+ select count(1)
+ from ja_fw_effect_eval ee
+ join ja_fw_device d on d.id = ee.device_id and d.is_deleted = 0
+ where ee.is_deleted = 0
+ and ee.counter_effect = 'success'
+ and find_in_set(d.id, replace(ad.device_ids, ' ', ''))
+ )
+ end as counter_success_count
+ from ja_fw_area_divide ad
+ <where>
+ ad.is_deleted = 0
+ and exists (
+ select 1
+ from ja_fw_defense_scene ds
+ join ja_fw_defense_scene_manage dsm on dsm.defense_scene_id = ds.id and dsm.is_deleted = 0
+ where ds.is_deleted = 0
+ and find_in_set(ad.id, ds.area_divide_ids)
+ )
+ <if test="param2.id != null and param2.id != ''">
+ and ad.id = #{param2.id}
+ </if>
+ <if test="param2.areaName != null and param2.areaName != ''">
+ and ad.area_name like concat('%', #{param2.areaName}, '%')
+ </if>
+ <if test="param2.sceneType != null and param2.sceneType != ''">
+ and exists (
+ select 1
+ from ja_fw_defense_scene ds
+ where ds.is_deleted = 0
+ and find_in_set(ad.id, ds.area_divide_ids)
+ and ds.scene_type = #{param2.sceneType}
+ )
+ </if>
+ <if test="param2.areaCode != null and param2.areaCode != ''">
+ and ad.area_code = #{param2.areaCode}
+ </if>
+ <if test="param2.areaTypeKeyList != null and param2.areaTypeKeyList.size > 0">
+ and (
+ <foreach collection="param2.areaTypeKeyList" item="key" separator=" or ">
+ find_in_set(#{key}, ad.area_type_keys)
+ </foreach>
+ )
+ </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>
+
+ <select id="selectFwAreaDivideStatisticsDetail" resultMap="fwAreaDivideStatisticsResultMap">
+ select
+ stats.id,
+ stats.area_name,
+ stats.area_type_keys,
+ 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
+ from (
+ select
+ ad.id,
+ ad.area_name,
+ ad.area_type_keys,
+ (
+ select group_concat(distinct ds.scene_name)
+ from ja_fw_defense_scene ds
+ where ds.is_deleted = 0
+ and find_in_set(ad.id, ds.area_divide_ids)
+ ) as scene_name,
+ (
+ select group_concat(distinct ds.scene_type)
+ from ja_fw_defense_scene ds
+ where ds.is_deleted = 0
+ and find_in_set(ad.id, ds.area_divide_ids)
+ ) as scene_type,
+ case
+ when ad.device_ids is null or trim(ad.device_ids) = '' then 0
+ else length(replace(ad.device_ids, ' ', '')) - length(replace(replace(ad.device_ids, ' ', ''), ',', '')) + 1
+ end as device_count,
+ case
+ when ad.device_ids is null or trim(ad.device_ids) = '' then 0
+ else (
+ select count(1)
+ from ja_fw_drone_alarm_record ar
+ join ja_fw_device d on d.id = ar.device_id and d.is_deleted = 0
+ where ar.is_deleted = 0
+ and find_in_set(d.id, replace(ad.device_ids, ' ', ''))
+ )
+ end as alarm_count,
+ case
+ when ad.device_ids is null or trim(ad.device_ids) = '' then 0
+ else (
+ select count(1)
+ from ja_fw_effect_eval ee
+ join ja_fw_device d on d.id = ee.device_id and d.is_deleted = 0
+ where ee.is_deleted = 0
+ and find_in_set(d.id, replace(ad.device_ids, ' ', ''))
+ )
+ end as counter_count,
+ case
+ when ad.device_ids is null or trim(ad.device_ids) = '' then 0
+ else (
+ select count(1)
+ from ja_fw_effect_eval ee
+ join ja_fw_device d on d.id = ee.device_id and d.is_deleted = 0
+ where ee.is_deleted = 0
+ and ee.counter_effect = 'success'
+ and find_in_set(d.id, replace(ad.device_ids, ' ', ''))
+ )
+ end as counter_success_count
+ from ja_fw_area_divide ad
+ <where>
+ ad.is_deleted = 0
+ <if test="id != null and id != ''">
+ and ad.id = #{id}
+ </if>
+ <if test="areaCode != null and areaCode != ''">
+ and ad.area_code = #{areaCode}
+ </if>
+ </where>
+ ) stats
</select>
<select id="exportFwAreaDivide" resultType="org.sxkj.fw.area.excel.FwAreaDivideExcel">
- SELECT * FROM ja_fw_area_divide ${ew.customSqlSegment}
+ SELECT
+ id,
+ area_name,
+ trigger_condition,
+ response_mechanism,
+ control_level,
+ police_station_id,
+ device_ids,
+ fly_date_start,
+ fly_date_end,
+ area_code,
+ create_user,
+ create_dept,
+ create_time,
+ update_user,
+ update_time,
+ status,
+ is_deleted
+ FROM ja_fw_area_divide ${ew.customSqlSegment}
</select>
+ <insert id="insertWithGeom" parameterType="org.sxkj.fw.area.entity.FwAreaDivideEntity" useGeneratedKeys="true" keyProperty="id">
+ insert into ja_fw_area_divide (
+ id,
+ area_name,
+ trigger_condition,
+ response_mechanism,
+ control_level,
+ police_station_id,
+ device_ids,
+ fly_date_start,
+ fly_date_end,
+ area_code,
+ area_type_keys,
+ create_user,
+ create_dept,
+ create_time,
+ update_user,
+ update_time,
+ status,
+ is_deleted
+ ) values (
+ #{id},
+ #{areaName},
+ #{triggerCondition},
+ #{responseMechanism},
+ #{controlLevel},
+ #{policeStationId},
+ #{deviceIds},
+ #{flyDateStart},
+ #{flyDateEnd},
+ #{areaCode},
+ #{areaTypeKeys},
+ #{createUser},
+ #{createDept},
+ #{createTime},
+ #{updateUser},
+ #{updateTime},
+ IFNULL(#{status}, '0'),
+ IFNULL(#{isDeleted}, 0)
+ )
+ </insert>
+
+ <update id="updateWithGeomById" parameterType="org.sxkj.fw.area.entity.FwAreaDivideEntity">
+ update ja_fw_area_divide
+ <set>
+ <if test="areaName != null">area_name = #{areaName},</if>
+ <if test="triggerCondition != null">trigger_condition = #{triggerCondition},</if>
+ <if test="responseMechanism != null">response_mechanism = #{responseMechanism},</if>
+ <if test="controlLevel != null">control_level = #{controlLevel},</if>
+ <if test="policeStationId != null">police_station_id = #{policeStationId},</if>
+ <if test="deviceIds != null">device_ids = #{deviceIds},</if>
+ <if test="flyDateStart != null">fly_date_start = #{flyDateStart},</if>
+ <if test="flyDateEnd != null">fly_date_end = #{flyDateEnd},</if>
+ <if test="areaCode != null">area_code = #{areaCode},</if>
+ <if test="areaTypeKeys != null">area_type_keys = #{areaTypeKeys},</if>
+ <if test="createUser != null">create_user = #{createUser},</if>
+ <if test="createDept != null">create_dept = #{createDept},</if>
+ <if test="createTime != null">create_time = #{createTime},</if>
+ <if test="updateUser != null">update_user = #{updateUser},</if>
+ <if test="updateTime != null">update_time = #{updateTime},</if>
+ <if test="status != null">status = #{status},</if>
+ <if test="isDeleted != null">is_deleted = #{isDeleted},</if>
+ </set>
+ where id = #{id}
+ </update>
+
</mapper>
--
Gitblit v1.9.3