| | |
| | | <result column="update_user" property="updateUser"/> |
| | | <result column="update_time" property="updateTime"/> |
| | | <result column="status" property="status"/> |
| | | <result column="is_deleted" property="isDeleted"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="fwAreaDivideStatisticsResultMap" type="org.sxkj.fw.area.vo.FwAreaDivideStatisticsVO"> |
| | |
| | | |
| | | <select id="selectFwAreaDividePage" resultMap="fwAreaDivideResultMap"> |
| | | select |
| | | ad.id, |
| | | ad.area_name, |
| | | ad.longitude, |
| | | ad.latitude, |
| | | ad.area_size, |
| | | case |
| | | when ad.geom is null then null |
| | | when ST_SRID(ad.geom) is null or ST_SRID(ad.geom) = 0 then ST_AsText(ad.geom) |
| | | else concat(ST_AsText(ST_SwapXY(ad.geom)), ' | ', ST_SRID(ad.geom)) |
| | | end as geom, |
| | | ad.area_type, |
| | | ad.trigger_condition, |
| | | ad.response_mechanism, |
| | | ad.control_level, |
| | | ad.police_station_id, |
| | | ad.device_ids, |
| | | ad.fly_date_start, |
| | | ad.fly_date_end, |
| | | ad.area_code, |
| | | ps.station_name as police_station_name, |
| | | ad.create_user, |
| | | ad.create_dept, |
| | | ad.create_time, |
| | | ad.update_user, |
| | | ad.update_time, |
| | | ad.status, |
| | | ad.is_deleted |
| | | from ja_fw_area_divide ad |
| | | left join ja_fw_police_station ps on ps.id = ad.police_station_id and ps.is_deleted = 0 |
| | | ad.id, |
| | | ad.area_name, |
| | | ad.longitude, |
| | | ad.latitude, |
| | | ad.area_size, |
| | | case |
| | | when ad.geom is null then null |
| | | when ST_SRID(ad.geom) is null or ST_SRID(ad.geom) = 0 then ST_AsText(ad.geom) |
| | | else concat(ST_AsText(ST_SwapXY(ad.geom)), ' | ', ST_SRID(ad.geom)) |
| | | end as geom, |
| | | ad.area_type, |
| | | ad.trigger_condition, |
| | | ad.response_mechanism, |
| | | ad.control_level, |
| | | ad.police_station_id, |
| | | ad.device_ids, |
| | | ad.fly_date_start, |
| | | ad.fly_date_end, |
| | | ad.area_code, |
| | | ps.station_name as police_station_name, |
| | | ad.create_user, |
| | | ad.create_dept, |
| | | ad.create_time, |
| | | ad.update_user, |
| | | ad.update_time, |
| | | ad.status, |
| | | ad.is_deleted |
| | | from |
| | | ja_fw_area_divide ad |
| | | left join |
| | | ja_fw_police_station ps on ps.id = ad.police_station_id and ps.is_deleted = 0 |
| | | <where> |
| | | ad.is_deleted = 0 |
| | | ad.is_deleted = 0 |
| | | <if test="param2.id != null and param2.id != ''"> |
| | | and ad.id = #{param2.id} |
| | | </if> |
| | |
| | | <if test="param2.areaCode != null and param2.areaCode != ''"> |
| | | and ad.area_code = #{param2.areaCode} |
| | | </if> |
| | | <if test="param2.deptList != null and param2.deptList.size > 0"> |
| | | and ad.create_dept in |
| | | <foreach collection="param2.deptList" item="deptId" open="(" separator="," close=")"> |
| | | #{deptId} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | |
| | | 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> |
| | | |
| | | <select id="selectAreaCountByDeviceId" resultType="java.lang.Integer"> |
| | | select count(1) |
| | | from ja_fw_area_divide ad |
| | | <where> |
| | | ad.is_deleted = 0 |
| | | and ad.device_ids is not null |
| | | and ad.device_ids != '' |
| | | and find_in_set(#{deviceId}, replace(ad.device_ids, ' ', '')) |
| | | </where> |
| | | </select> |
| | | |
| | |
| | | |
| | | <select id="selectFwAreaDivideStatisticsPage" resultMap="fwAreaDivideStatisticsResultMap"> |
| | | select |
| | | stats.id, |
| | | stats.area_name, |
| | | stats.area_type, |
| | | stats.scene_name, |
| | | stats.scene_type, |
| | | stats.device_count, |
| | | stats.alarm_count, |
| | | stats.counter_count, |
| | | stats.counter_success_count, |
| | | case |
| | | when stats.counter_count = 0 then '/' |
| | | when stats.counter_success_count * 100.0 / stats.counter_count >= 80 then '好' |
| | | when stats.counter_success_count * 100.0 / stats.counter_count >= 60 then '一般' |
| | | stats.id, |
| | | stats.area_name, |
| | | stats.area_type, |
| | | stats.scene_name, |
| | | stats.scene_type, |
| | | stats.device_count, |
| | | stats.alarm_count, |
| | | stats.counter_count, |
| | | stats.counter_success_count, |
| | | case |
| | | when stats.counter_count = 0 then '/' |
| | | when stats.counter_success_count * 100.0 / stats.counter_count >= 80 then '好' |
| | | when stats.counter_success_count * 100.0 / stats.counter_count >= 60 then '一般' |
| | | else '差' |
| | | end as control_effect |
| | | end as control_effect |
| | | from ( |
| | | select |
| | | ad.id, |
| | |
| | | <if test="param2.areaCode != null and param2.areaCode != ''"> |
| | | and ad.area_code = #{param2.areaCode} |
| | | </if> |
| | | <if test="param2.deptList != null and param2.deptList.size > 0"> |
| | | and ad.create_dept in |
| | | <foreach collection="param2.deptList" item="deptId" open="(" separator="," close=")"> |
| | | #{deptId} |
| | | </foreach> |
| | | </if> |
| | | </where> |
| | | ) stats |
| | | </select> |