| | |
| | | dsm.*, |
| | | ds.scene_name as defense_scene_name |
| | | from ja_fw_defense_scene_manage dsm |
| | | left join ja_fw_defense_scene ds on ds.id::VARCHAR = dsm.defense_scene_id::VARCHAR and ds.is_deleted = 0 |
| | | left join ja_fw_area_divide ad on ad.id = ANY(string_to_array(ds.area_divide_ids, ',')::bigint[]) and ad.is_deleted = 0 |
| | | left join ja_fw_defense_scene ds on ds.id::text = dsm.defense_scene_id::text and ds.is_deleted = 0 |
| | | left join ja_fw_area_divide ad on ad.id::text = ANY(string_to_array(replace(ds.area_divide_ids, ' ', ''), ',')) and ad.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 |
| | | 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="fwBaseInfo.regionCode != null and fwBaseInfo.regionCode != ''"> |
| | | and ( d.final_outbound_area_code like concat(#{fwBaseInfo.regionCode},'%') |
| | | <if test="fwBaseInfo.currentDeptId != null and fwBaseInfo.currentDeptId != '' "> |
| | | or d.id in ( |
| | | SELECT device_id FROM ja_fw_device_per_share |
| | | WHERE loan_to_dept_id = #{fwBaseInfo.currentDeptId} |
| | | AND is_deleted = 0 |
| | | ) |
| | | </if> |
| | | ) |
| | | </if> |
| | | GROUP BY |
| | | d.id |
| | | ) dd ON dd.id::text = ANY(string_to_array(replace(ad.device_ids, ' ', ''), ',')) |
| | | or d.id in ( |
| | | SELECT device_id FROM ja_fw_device_per_share |
| | | WHERE |
| | | loan_to_dept_id = #{fwBaseInfo.currentDeptId}::bigint |
| | | AND is_deleted = 0 |
| | | ) |
| | | </if> |
| | | ) |
| | | </if> |
| | | GROUP BY |
| | | d.id |
| | | ) dd ON dd.id::text = ANY(string_to_array(replace(ad.device_ids, ' ', ''), ',')) |
| | | <where> |
| | | dsm.is_deleted = 0 |
| | | <if test="time != null"> |