吉安感知网项目-后端
linwei
2026-04-02 63b484f3fceb54cf545b3c8b722a6f0fceae1689
drone-service/drone-fw/src/main/java/org/sxkj/fw/area/mapper/FwAreaDivideMapper.xml
@@ -79,7 +79,7 @@
            <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)
                        ARRAY_POSITION(string_to_array(ad.area_type_keys, ','), #{key}) IS NOT NULL
                    </foreach>
                )
            </if>
@@ -116,7 +116,7 @@
                    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 ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
                )
            </if>
            <if test="isSetSceneManage != null and isSetSceneManage == 1 and flyTime != null">
@@ -127,7 +127,7 @@
                    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 ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
                      and (dsm.effective_date_start is null or dsm.effective_date_start &lt;= #{flyTime})
                      and (dsm.effective_date_end is null or dsm.effective_date_end &gt;= #{flyTime})
                )
@@ -140,7 +140,7 @@
                        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 ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
                    )
                    <if test="sceneId != null">
                        or exists (
@@ -150,7 +150,7 @@
                              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, ' ', ''))
                              and ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
                        )
                    </if>
                )
@@ -163,13 +163,13 @@
                      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, ' ', ''))
                      and ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
                )
            </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)
                        ARRAY_POSITION(string_to_array(ad.area_type_keys, ','), #{key}) IS NOT NULL
                    </foreach>
                )
            </if>
@@ -189,7 +189,7 @@
            <if test="deviceIds != null and deviceIds.size > 0">
                and (
                    <foreach collection="deviceIds" item="deviceId" separator=" or ">
                        find_in_set(#{deviceId}, replace(ad.device_ids, ' ', ''))
                        #{deviceId} = ANY(string_to_array(replace(ad.device_ids, ' ', ''), ',')::bigint[])
                    </foreach>
                )
            </if>
@@ -209,7 +209,7 @@
            <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, ' ', ''))
                        #{areaId} = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
                    </foreach>
                )
            </if>
@@ -223,7 +223,7 @@
            ad.is_deleted = 0
            and ad.device_ids is not null
            and ad.device_ids != ''
            and find_in_set(#{deviceId}, replace(ad.device_ids, ' ', ''))
            and #{deviceId} = ANY(string_to_array(replace(ad.device_ids, ' ', ''), ',')::bigint[])
        </where>
    </select>
@@ -266,14 +266,14 @@
                from ja_fw_defense_scene ds
                join ja_fw_defense_scene_manage dsm on dsm.defense_scene_id = ds.id::VARCHAR and dsm.is_deleted = 0
                where ds.is_deleted = 0
                  and find_in_set(ad.id, ds.area_divide_ids)
                  and ad.id = ANY(string_to_array(ds.area_divide_ids, ',')::bigint[])
            ) as scene_name,
            (
                select group_concat(distinct ds.scene_type)
                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 = ds.id::VARCHAR and dsm.is_deleted = 0
                where ds.is_deleted = 0
                  and find_in_set(ad.id, ds.area_divide_ids)
                  and ad.id = ANY(string_to_array(ds.area_divide_ids, ',')::bigint[])
            ) as scene_type,
            case
                when ad.device_ids is null or trim(ad.device_ids) = '' then 0
@@ -286,7 +286,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 find_in_set(d.id, replace(ad.device_ids, ' ', ''))
                      and d.id = ANY(string_to_array(replace(ad.device_ids, ' ', ''), ',')::bigint[])
                )
            end as alarm_count,
            case
@@ -296,7 +296,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 find_in_set(d.id, replace(ad.device_ids, ' ', ''))
                      and d.id = ANY(string_to_array(replace(ad.device_ids, ' ', ''), ',')::bigint[])
                )
            end as counter_count,
            case
@@ -307,7 +307,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 find_in_set(d.id, replace(ad.device_ids, ' ', ''))
                      and d.id = ANY(string_to_array(replace(ad.device_ids, ' ', ''), ',')::bigint[])
                )
            end as counter_success_count
            from ja_fw_area_divide ad
@@ -318,7 +318,7 @@
                    from ja_fw_defense_scene ds
                    join ja_fw_defense_scene_manage dsm on dsm.defense_scene_id = ds.id::VARCHAR and dsm.is_deleted = 0
                    where ds.is_deleted = 0
                      and find_in_set(ad.id, ds.area_divide_ids)
                      and ad.id = ANY(string_to_array(ds.area_divide_ids, ',')::bigint[])
                )
                <if test="param2.id != null and param2.id != ''">
                    and ad.id = #{param2.id}
@@ -331,7 +331,7 @@
                        select 1
                        from ja_fw_defense_scene ds
                        where ds.is_deleted = 0
                          and find_in_set(ad.id, ds.area_divide_ids)
                          and ad.id = ANY(string_to_array(ds.area_divide_ids, ',')::bigint[])
                          and ds.scene_type = #{param2.sceneType}
                    )
                </if>
@@ -341,7 +341,7 @@
                <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)
                            ARRAY_POSITION(string_to_array(ad.area_type_keys, ','), #{key}) IS NOT NULL
                        </foreach>
                    )
                </if>
@@ -378,16 +378,16 @@
        ad.area_name,
        ad.area_type_keys,
        (
            select group_concat(distinct ds.scene_name)
            select string_agg(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)
                  and ad.id = ANY(string_to_array(ds.area_divide_ids, ',')::bigint[])
            ) as scene_name,
            (
                select group_concat(distinct ds.scene_type)
                select string_agg(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)
                  and ad.id = ANY(string_to_array(ds.area_divide_ids, ',')::bigint[])
            ) as scene_type,
            case
                when ad.device_ids is null or trim(ad.device_ids) = '' then 0
@@ -400,7 +400,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 find_in_set(d.id, replace(ad.device_ids, ' ', ''))
                      and d.id = ANY(string_to_array(replace(ad.device_ids, ' ', ''), ',')::bigint[])
                )
            end as alarm_count,
            case
@@ -410,7 +410,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 find_in_set(d.id, replace(ad.device_ids, ' ', ''))
                      and d.id = ANY(string_to_array(replace(ad.device_ids, ' ', ''), ',')::bigint[])
                )
            end as counter_count,
            case
@@ -421,7 +421,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 = 'success'
                      and find_in_set(d.id, replace(ad.device_ids, ' ', ''))
                      and d.id = ANY(string_to_array(replace(ad.device_ids, ' ', ''), ',')::bigint[])
                )
            end as counter_success_count
            from ja_fw_area_divide ad
@@ -490,7 +490,7 @@
                </if>
                GROUP BY
                    d.id
        ) dd on find_in_set(dd.id, ad.device_ids)
        ) dd on dd.id = ANY(string_to_array(replace(ad.device_ids, ' ', ''), ',')::bigint[])
        <where>
            ad.is_deleted = 0
            <if test="isSetSceneManage != null and isSetSceneManage == 1">
@@ -501,7 +501,7 @@
                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 ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
                )
            </if>
            <if test="isSetSceneManage != null and isSetSceneManage == 1 and flyTime != null">
@@ -512,7 +512,7 @@
                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 ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
                and (dsm.effective_date_start is null or dsm.effective_date_start &lt;= #{flyTime})
                and (dsm.effective_date_end is null or dsm.effective_date_end &gt;= #{flyTime})
                )
@@ -525,7 +525,7 @@
                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 ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
                )
                <if test="sceneId != null">
                    or exists (
@@ -535,7 +535,7 @@
                    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, ' ', ''))
                    and ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
                    )
                </if>
                )
@@ -548,13 +548,13 @@
                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, ' ', ''))
                and ad.id = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')::bigint[])
                )
            </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)
                    ARRAY_POSITION(string_to_array(ad.area_type_keys, ','), #{key}) IS NOT NULL
                </foreach>
                )
            </if>
@@ -567,7 +567,7 @@
        from ja_fw_defense_scene_manage dsm
        left join ja_fw_defense_scene ds on ds.id = dsm.defense_scene_id::VARCHAR and ds.is_deleted = 0
        where ds.is_deleted = 0
        and find_in_set(#{areaId}, ds.area_divide_ids)
        and #{areaId} = ANY(string_to_array(ds.area_divide_ids, ',')::bigint[])
        and dsm.is_deleted = 0
    </select>