| | |
| | | left join ja_fw_police_station ps on ps.id = ad.police_station_id and ps.is_deleted = 0 |
| | | <where> |
| | | ad.is_deleted = 0 |
| | | <choose> |
| | | <when test="sceneId != null"> |
| | | and exists ( |
| | | <if test="filterSelected != null and filterSelected == 1"> |
| | | and ( |
| | | not exists ( |
| | | select 1 |
| | | from ja_fw_defense_scene ds |
| | | where ds.is_deleted = 0 |
| | | 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, ' ', '')) |
| | | ) |
| | | </when> |
| | | <when test="filterSelected != null and filterSelected == 1"> |
| | | and not exists ( |
| | | select 1 |
| | | from ja_fw_defense_scene ds |
| | | where ds.is_deleted = 0 |
| | | and ds.area_divide_ids is not null |
| | | and ds.area_divide_ids != '' |
| | | and find_in_set(ad.id, ds.area_divide_ids) |
| | | ) |
| | | </when> |
| | | </choose> |
| | | <if test="sceneId != null"> |
| | | or exists ( |
| | | select 1 |
| | | from ja_fw_defense_scene ds |
| | | where ds.is_deleted = 0 |
| | | 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, ' ', '')) |
| | | ) |
| | | </if> |
| | | ) |
| | | </if> |
| | | <if test="sceneId != null and (filterSelected == null or filterSelected != 1)"> |
| | | and exists ( |
| | | select 1 |
| | | from ja_fw_defense_scene ds |
| | | where ds.is_deleted = 0 |
| | | 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, ' ', '')) |
| | | ) |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectFwAreaDivideListByDeviceIds" resultMap="fwAreaDivideResultMap"> |
| | | select |
| | | ad.id, |
| | | ad.area_name, |
| | | ad.device_ids |
| | | from ja_fw_area_divide ad |
| | | <where> |
| | | ad.is_deleted = 0 |
| | | and ad.device_ids is not null |
| | | and ad.device_ids != '' |
| | | <if test="deviceIds != null and deviceIds.size > 0"> |
| | | and ( |
| | | <foreach collection="deviceIds" item="deviceId" separator=" or "> |
| | | find_in_set(#{deviceId}, replace(ad.device_ids, ' ', '')) |
| | | </foreach> |
| | | ) |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectFwDefenseSceneListByAreaIds" resultType="org.sxkj.fw.area.vo.FwDefenseSceneVO"> |
| | | select |
| | | ds.id, |
| | | ds.scene_name as sceneName, |
| | | ds.area_divide_ids as areaDivideIds |
| | | from ja_fw_defense_scene ds |
| | | <where> |
| | | ds.is_deleted = 0 |
| | | and ds.area_divide_ids is not null |
| | | and ds.area_divide_ids != '' |
| | | <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, ' ', '')) |
| | | </foreach> |
| | | ) |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |