insert into t_analysis_problem_green_hour (id,green_id,area_id,event_category,event_type,dir,event_number,event_total_time,window_start_time,window_end_time,dt,insert_time)
insert into t_analysis_problem_green_hour (id,green_id,area_id,event_category,event_type,dir,event_number,event_total_time,window_start_time,window_end_time,dt,insert_time)
select uuid(), d.green_id, e.area_id,d.category,d.type,d.dir,count(1) as event_number , sum( TIMESTAMPDIFF(SECOND, d.start_time , d.end_time) ) as duration ,
select uuid(), d.green_id, e.area_id,d.category,d.type,d.dir,count(1) as event_number , sum( TIMESTAMPDIFF(SECOND, d.start_time , d.end_time) ) as duration ,
DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 HOUR),'%Y-%m-%d %H:00:00') as dh1, DATE_FORMAT(now(),'%Y-%m-%d %H:00:00') as dh2,
DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 HOUR),'%Y-%m-%d %H:00:00') as dh1, DATE_FORMAT(now(),'%Y-%m-%d %H:00:00') as dh2,
DATE_FORMAT(now(),'%Y%m%d') as dt , now()
DATE_FORMAT(now(),'%Y%m%d') as dt , now()
from
from
(select DISTINCT b.green_id,b.category,b.type,b.start_time,b.end_time, SUBSTRING_INDEX( SUBSTRING_INDEX( b.dir, ',', c.help_topic_id + 1 ), ',', -1 ) AS dir
(select DISTINCT b.green_id,b.category,b.type,b.start_time,b.end_time, SUBSTRING_INDEX( SUBSTRING_INDEX( b.dir, ',', c.help_topic_id + 1 ), ',', -1 ) AS dir
from
from
(select a.green_id,a.category,a.type,a.start_time,a.end_time,SUBSTR(a.dir,2,LENGTH(a.dir)-2) as dir
(select a.green_id,a.category,a.type,a.start_time,a.end_time,SUBSTR(a.dir,2,LENGTH(a.dir)-2) as dir
from t_event_info a
from t_event_info a
where DATE_FORMAT(a.start_time,'%Y-%m-%d %H:%i:%s') >= DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 HOUR),'%Y-%m-%d %H:00:00')
where DATE_FORMAT(a.start_time,'%Y-%m-%d %H:%i:%s') >= DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 HOUR),'%Y-%m-%d %H:00:00')
and DATE_FORMAT(a.start_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ < ]]> DATE_FORMAT(now(),'%Y-%m-%d %H:00:00')
and DATE_FORMAT(a.start_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ < ]]> DATE_FORMAT(now(),'%Y-%m-%d %H:00:00')
and a.type in (705,706) and a.green_id != ''
and a.type in (705,706) and a.green_id != ''
and a.dir is not null
and a.dir is not null
and length(a.dir)>2
and length(a.dir)>2
) b
) b
INNER JOIN mysql.help_topic c ON c.help_topic_id <![CDATA[ < ]]> (
INNER JOIN mysql.help_topic c ON c.help_topic_id <![CDATA[ < ]]> (
SELECT b.start_time as startTime,b.end_time as endTime,cycle from t_base_cross_schedules_plan as a LEFT JOIN t_base_cross_section as b on a.plan_id = b.plan_id LEFT JOIN t_base_cross_scheme as c on b.scheme_id = c.id where a.cross_id = #{crossId} and a.week = #{weekNumber} ORDER BY start_time
SELECT b.start_time as startTime,b.end_time as endTime,cycle from t_base_cross_schedules_plan as a LEFT JOIN t_base_cross_section as b on a.plan_id = b.plan_id LEFT JOIN t_base_cross_scheme as c on b.scheme_id = c.id where a.cross_id = #{crossId} and a.week = #{weekNumber} ORDER BY start_time
SELECT b.start_time as startTime,b.end_time as endTime,cycle from t_base_cross_section as b LEFT JOIN t_base_cross_scheme as c on b.scheme_id = c.id where b.cross_id = #{crossId} and b.plan_id = #{planId} ORDER BY start_time
SELECT b.start_time as startTime,b.end_time as endTime,cycle from t_base_cross_section as b LEFT JOIN t_base_cross_scheme as c on b.scheme_id = c.id where b.cross_id = #{crossId} and b.plan_id = #{planId} ORDER BY start_time