吉安感知网项目-后端
linwei
2026-04-02 3d18ecb5b898b1412ad1ab39b0303d4edd49cd69
opt: sql改造其他模块改造6
1 files modified
16 ■■■■■ changed files
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwAreaDivideMapper.xml 16 ●●●●● patch | view | raw | blame | history
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwAreaDivideMapper.xml
@@ -266,15 +266,13 @@
                from ja_fw_defense_scene ds
                join ja_fw_defense_scene_manage dsm on dsm.defense_scene_id::VARCHAR = ds.id::VARCHAR and dsm.is_deleted = 0
                where ds.is_deleted = 0
                  and ad.id = ANY(string_to_array(ds.area_divide_ids, ',')::bigint[])
            ) as scene_name,
                AND ad.id::VARCHAR = ANY(string_to_array(ds.area_divide_ids, ','))) AS scene_name,
            (
                select string_agg(distinct ds.scene_type, ',')
                from ja_fw_defense_scene ds
                join ja_fw_defense_scene_manage dsm on dsm.defense_scene_id::VARCHAR = ds.id::VARCHAR and dsm.is_deleted = 0
                where ds.is_deleted = 0
                  and ad.id = ANY(string_to_array(ds.area_divide_ids, ',')::bigint[])
            ) as scene_type,
                AND ad.id::VARCHAR = ANY(string_to_array(ds.area_divide_ids, ','))) AS scene_name,
            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
@@ -286,7 +284,7 @@
                    from ja_fw_drone_alarm_record ar
                    join ja_fw_device d on d.id = ar.device_id::VARCHAR and d.is_deleted = 0
                    where ar.is_deleted = 0
                      and d.id = ANY(string_to_array(replace(ad.device_ids, ' ', ''), ',')::bigint[])
                      and d.id::VARCHAR = ANY(string_to_array(ad.device_ids, ','))
                )
            end as alarm_count,
            case
@@ -296,7 +294,7 @@
                    from ja_fw_effect_eval ee
                    join ja_fw_device d on d.id = ee.device_id::VARCHAR and d.is_deleted = 0
                    where ee.is_deleted = 0
                      and d.id = ANY(string_to_array(replace(ad.device_ids, ' ', ''), ',')::bigint[])
                      and d.id::VARCHAR = ANY(string_to_array(ad.device_ids, ','))
                )
            end as counter_count,
            case
@@ -307,7 +305,7 @@
                    join ja_fw_device d on d.id = ee.device_id::VARCHAR and d.is_deleted = 0
                    where ee.is_deleted = 0
                      and ee.counter_effect = '1'
                      and d.id = ANY(string_to_array(replace(ad.device_ids, ' ', ''), ',')::bigint[])
                      and d.id::VARCHAR = ANY(string_to_array(ad.device_ids, ','))
                )
            end as counter_success_count
            from ja_fw_area_divide ad
@@ -318,7 +316,7 @@
                    from ja_fw_defense_scene ds
                    join ja_fw_defense_scene_manage dsm on dsm.defense_scene_id::VARCHAR = ds.id::VARCHAR and dsm.is_deleted = 0
                    where ds.is_deleted = 0
                      and ad.id = ANY(string_to_array(ds.area_divide_ids, ',')::bigint[])
                    and d.id::VARCHAR = ANY(string_to_array(ad.device_ids, ','))
                )
                <if test="param2.id != null and param2.id != ''">
                    and ad.id = #{param2.id}
@@ -331,7 +329,7 @@
                        select 1
                        from ja_fw_defense_scene ds
                        where ds.is_deleted = 0
                          and ad.id = ANY(string_to_array(ds.area_divide_ids, ',')::bigint[])
                        and d.id::VARCHAR = ANY(string_to_array(ad.device_ids, ','))
                          and ds.scene_type = #{param2.sceneType}
                    )
                </if>