case when a.type=701 then 5 when a.type=702 then 1 when a.type=703 then 3 when a.type=707 then 2 else ifnull(a.type,0) end as status,
case when a.type=701 then 5 when a.type=702 then 1 when a.type=703 then 3 when a.type=707 then 2 else ifnull(a.type,0) end as status,
c.id as cross_id,
c.id as cross_id,
c.name as cross_name ,
c.name as cross_name ,
b.label as current_algo,
b.label as current_algo,
SUBSTRING(c.location FROM 7 FOR 20) as wkt,
SUBSTRING(c.location FROM 7 FOR 20) as wkt,
ifnull(a.alarm_status,-1) alarm_status,
ifnull(a.alarm_status,-1) alarm_status,
a.opt_status
a.opt_status,
dir,
if(turn='null',null,turn) turn
from t_base_cross_info c
from t_base_cross_info c
left join (select * from t_event_info where dt = DATE_FORMAT(NOW(),'%Y%m%d') and type in (701,702,703,707) and alarm_status in (0,1,2)) a on a.cross_id = c.id
left join (select * from t_event_info where dt = DATE_FORMAT(NOW(),'%Y%m%d') and type in (701,702,703,707) and alarm_status in (0,1,2)) a on a.cross_id = c.id
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 (select a.event_type, a.label from t_config_event_category a where a.category = 4) b on a.type = b.event_type