From dbc7e62be76ff48b26461ffaef9c3fc87be018cb Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Wed, 11 Feb 2026 11:05:32 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwAreaDivideMapper.xml |   74 ++++++++++++++++++++++++++++++++++++-
 1 files changed, 72 insertions(+), 2 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 7a4db23..bca71ed 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
@@ -23,6 +23,7 @@
     <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"/>
@@ -100,7 +101,13 @@
         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="deptList != null and deptList.size > 0">
+                and ad.create_dept in
+                <foreach collection="deptList" item="deptId" open="(" separator="," close=")">
+                    #{deptId}
+                </foreach>
+            </if>
             <if test="isSetSceneManage != null and isSetSceneManage == 1">
                 and exists (
                     select 1
@@ -236,6 +243,7 @@
         select
             stats.id,
             stats.area_name,
+            stats.area_type_keys,
             stats.scene_name,
             stats.scene_type,
             stats.device_count,
@@ -252,15 +260,18 @@
             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,
@@ -295,13 +306,20 @@
                     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 ee.counter_effect = '1'
                       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>
@@ -320,6 +338,13 @@
                 <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=")">
@@ -334,6 +359,7 @@
         select
         stats.id,
         stats.area_name,
+        stats.area_type_keys,
         stats.scene_name,
         stats.scene_type,
         stats.device_count,
@@ -350,6 +376,7 @@
         select
         ad.id,
         ad.area_name,
+        ad.area_type_keys,
         (
             select group_concat(distinct ds.scene_name)
             from ja_fw_defense_scene ds
@@ -433,6 +460,49 @@
         FROM ja_fw_area_divide ${ew.customSqlSegment}
     </select>
 
+    <select id="selectFwAreaDivideListCockpit" resultType="org.sxkj.fw.area.vo.FwAreaDivideVO">
+        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
+        inner join (
+                SELECT
+                    d.id
+                FROM
+                    ja_fw_device d
+                WHERE
+                    d.is_deleted = 0
+                    AND d.is_enabled = 1
+                    AND d.final_outbound_area IS NOT NULL
+                <if test="regionCode != null and regionCode != ''">
+                    and ( d.final_outbound_area_code like concat(#{regionCode},'%')
+                    <if test="currentDeptId != null and currentDeptId != '' ">
+                        or d.id in (
+                        SELECT device_id FROM ja_fw_device_per_share
+                        WHERE loan_to_dept_id = #{currentDeptId}
+                        AND is_deleted = 0
+                        )
+                    </if>
+                    )
+                </if>
+                GROUP BY
+                    d.id
+        ) dd on find_in_set(dd.id, ad.device_ids)
+    </select>
+
+    <select id="checkAreaBindScene" resultType="java.lang.Boolean">
+        select
+        count(1)
+        from ja_fw_defense_scene_manage dsm
+        left join ja_fw_defense_scene ds on ds.id = dsm.defense_scene_id and ds.is_deleted = 0
+        where ds.is_deleted = 0
+        and find_in_set(#{areaId}, ds.area_divide_ids)
+        and dsm.is_deleted = 0
+    </select>
+
     <insert id="insertWithGeom" parameterType="org.sxkj.fw.area.entity.FwAreaDivideEntity" useGeneratedKeys="true" keyProperty="id">
         insert into ja_fw_area_divide (
             id,

--
Gitblit v1.9.3