| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | 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} |
| | |
| | | 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> |