case b.alarm_status when 0 then '未处理' when 1 then '分析中' when 2 then '优化中' end as type, b.opt_status,
case when b.issue_time > DATE_SUB(NOW(), INTERVAL 1 MINUTE) then '1' else '0' end as new_recoder, 1 as type2
case when b.issue_time > DATE_SUB(NOW(), INTERVAL 1 MINUTE) then '1' else '0' end as new_recoder, 1 as type2,b.event_type
from
(
<!-- 查询路口事件 -->
select a.green_id,a.cross_id,c.name as cross_name , a.start_time as issue_time, b.label as current_algo, SUBSTRING(c.location FROM 7 FOR 20) as wkt,a.alarm_status,a.opt_status
select a.type as event_type,a.green_id,a.cross_id,c.name as cross_name , a.start_time as issue_time, b.label as current_algo, SUBSTRING(c.location FROM 7 FOR 20) as wkt,a.alarm_status,a.opt_status
from t_event_info a
left join (select a.event_type, a.label from t_config_event_category a where a.category = 4) b on a.type = b.event_type
left join t_base_cross_info c on a.cross_id = c.id
where a.type in (701,702,703,707) and DATE(a.start_time) = CURDATE()
union
<!-- 查询干线事件 -->
select a.green_id,a.cross_id,c.name as cross_name , a.start_time as issue_time, b.label as current_algo, c.wkt,a.alarm_status,a.opt_status
select a.type as event_type,a.green_id,a.cross_id,c.name as cross_name , a.start_time as issue_time, b.label as current_algo, c.wkt,a.alarm_status,a.opt_status
from t_event_info a
left join (select a.event_type, a.label from t_config_event_category a where a.category = 4) b on a.type = b.event_type
left join t_greenwave_info c on a.green_id = c.id
where a.type in (705,706) and DATE(a.start_time) = CURDATE()
'已结束' as type, b.opt_status,'0' as new_recoder, 2 as type2
'已结束' as type, b.opt_status,'0' as new_recoder, 2 as type2,b.event_type
from
( <!-- 查询路口空放、失衡、溢出、拥堵事件 -->
select a.green_id,a.cross_id,c.name as cross_name , DATE_FORMAT(a.start_time,'%H:%i') as issue_time, b.label as current_algo, SUBSTRING(c.location FROM 7 FOR 20) as wkt,
select a.type as event_type,a.green_id,a.cross_id,c.name as cross_name , DATE_FORMAT(a.start_time,'%H:%i') as issue_time, b.label as current_algo, SUBSTRING(c.location FROM 7 FOR 20) as wkt,
a.alarm_status ,a.opt_status
from t_event_info a
left join (select a.event_type, a.label from t_config_event_category a where a.category = 4) b on a.type = b.event_type
...
...
@@ -145,28 +139,27 @@
where a.type in (701,702,703,707) and DATE(a.start_time) = CURDATE()
union
<!-- 查询干线事件缓行、拥堵事件 -->
select a.green_id,a.cross_id,c.name as cross_name , DATE_FORMAT(a.start_time,'%H:%i') as issue_time, b.label as current_algo, c.wkt,a.alarm_status ,a.opt_status
select a.type as event_type,a.green_id,a.cross_id,c.name as cross_name , DATE_FORMAT(a.start_time,'%H:%i') as issue_time, b.label as current_algo, c.wkt,a.alarm_status ,a.opt_status
from t_event_info a
left join (select a.event_type, a.label from t_config_event_category a where a.category = 4 ) b on a.type = b.event_type
left join t_greenwave_info c on a.green_id = c.id
where a.type in (705,706) and DATE(a.start_time) = CURDATE()