Commit 0a255002 authored by 黄伟铭's avatar 黄伟铭

国产化修改

parent 0f9e83a1
......@@ -37,18 +37,18 @@
lane_no ,
dir_type ,
turn_type ,
SUM(flow) flow,
round(AVG(speed),2) speed,
MAX(queue_length) max_queue_length,
MIN(queue_length) min_queue_length,
round(AVG(queue_length)) avg_queue_length,
round(AVG(stop_times),2) stop_times,
round(AVG(delay_time),2) delay_time,
round(AVG(traffic_index),2) traffic_index,
round(AVG(sturation),4) sturation,
round(AVG(green_light_efficiency),4) green_light_efficiency,
round(AVG(vehicle_length_ratio_mean),4) vehicle_length_ratio_mean,
STRING_AGG(service_level||'',',') service_level
SUM(flow) AS flow,
round(CAST(AVG(speed) AS NUMERIC),2) AS speed,
MAX(queue_length) AS max_queue_length,
MIN(queue_length) AS min_queue_length,
round(CAST(AVG(queue_length) AS NUMERIC)) AS avg_queue_length,
round(CAST(AVG(stop_times) AS NUMERIC),2) AS stop_times,
roundCAST(AVG(delay_time) AS NUMERIC),2) AS delay_time,
round(CAST(AVG(traffic_index) AS NUMERIC),2) AS traffic_index,
round(CAST(AVG(sturation) AS NUMERIC),4) AS sturation,
round(CAST(AVG(green_light_efficiency) AS NUMERIC),4) AS green_light_efficiency,
round(CAST(AVG(vehicle_length_ratio_mean) AS NUMERIC),4) AS vehicle_length_ratio_mean,
STRING_AGG(service_level||'',',') AS service_level
FROM
(
SELECT start_time,
......@@ -68,7 +68,7 @@
null as lane_no,
null as dir_type,
null as turn_type,
COALESCE(service_level,'A') service_level,
COALESCE(service_level,'A') AS service_level,
traffic_index,
green_light_efficiency,
null as vehicle_length_ratio_mean,
......@@ -123,7 +123,7 @@
and t.cross_id = #{crossId}
</if>
<if test="startDate !=null and endDate !=null">
and dt >= TO_CHAR(#{startDate},'YYYYMMDD') and dt &lt;= TO_CHAR(#{endDate},'YYYYMMDD')
and dt >= CAST(TO_CHAR(#{startDate},'YYYYMMDD') AS INT4) and dt &lt;= CAST(TO_CHAR(#{endDate},'YYYYMMDD') AS INT4)
AND start_time >= TO_TIMESTAMP(#{startDate},'YYYY-MM-DD HH24:MI:SS') and start_time &lt; TO_TIMESTAMP(#{endDate},'YYYY-MM-DD HH24:MI:SS')
</if>
<choose>
......
......@@ -457,7 +457,7 @@
INSERT INTO t_analysis_cross_slow_run_event ( cross_id, dir, start_time, end_time, dt, insert_time )
SELECT
cross_id,
concat( '[', STRING_AGG(dir_type||'',','), ']' ) dir,
concat( '[', STRING_AGG(dir_type||'',','), ']' ) as dir,
start_time,
DATE_ADD( start_time, INTERVAL 5 MINUTE ) AS end_time,
dt,
......@@ -474,9 +474,9 @@
count(*)>=2
ON CONFLICT (cross_id,dir,start_time)
DO UPDATE SET
end_time=EXCLUDED.end_time,
dt=EXCLUDED.dt,
insert_time=EXCLUDED.insert_time
end_time=excluded.end_time,
dt=excluded.dt,
insert_time=excluded.insert_time
</insert>
</mapper>
......@@ -131,7 +131,7 @@
<include refid="fuzzySearch"/>
</where>
<!--ORDER BY `dt_create_date` DESC-->
limit #{startRowNum}, #{pageSize}
limit #{pageSize} OFFSET #{startRowNum} - 1
</select>
<!--更新-->
......@@ -330,4 +330,43 @@
</set>
</sql>
</mapper>
......@@ -12,8 +12,8 @@
<select id="getGreenAndCross" resultMap="BaseResultMap" >
select a.green_id as greenId, c.name as greenName , a.cross_id as crossId , b.name as crossName ,a.sort
from t_greenwave_cross a
left join t_base_cross_info b on a.cross_id = b.id
left join t_greenwave_info c on a.green_id = c.id
left join t_base_cross_info b on a.cross_id = b.id
left join t_greenwave_info c on a.green_id = c.id
where a.green_id <![CDATA[ < ]]> 99
group by a.green_id ,a.sort
</select>
......@@ -25,40 +25,40 @@
<!-- 统一接口:绿波路口车道级指标趋势,支持按5分钟粒度、15分钟粒度、30分钟粒度、1小时粒度汇聚 -->
<select id="findCrossObjectIndex"
resultType="net.wanji.opt.po.base.CrossLaneDataHistPoExtend">
SELECT MIN(ifnull(t.unit_time,#{startDate})) start_time,
SELECT MIN(COALESCE(t.unit_time,#{startDate})) start_time,
(case
when #{groupType}=0 then DATE_FORMAT(DATE_ADD(t.unit_time,INTERVAL 5 MINUTE),'%Y-%m-%d %H:%i:00')
when #{groupType}=1 then DATE_FORMAT(DATE_ADD(t.unit_time,INTERVAL 15 MINUTE),'%Y-%m-%d %H:%i:00')
when #{groupType}=2 then DATE_FORMAT(DATE_ADD(t.unit_time,INTERVAL 30 MINUTE),'%Y-%m-%d %H:%i:00')
when #{groupType}=3 then DATE_FORMAT(DATE_ADD(t.unit_time,INTERVAL 60 MINUTE),'%Y-%m-%d %H:00:00')
when #{groupType}=0 then TO_CHAR(DATE_ADD(t.unit_time,INTERVAL 5 MINUTE),'YYYY-MM-DD HH24:MI:00')
when #{groupType}=1 then TO_CHAR(DATE_ADD(t.unit_time,INTERVAL 15 MINUTE),'YYYY-MM-DD HH24:MI:00')
when #{groupType}=2 then TO_CHAR(DATE_ADD(t.unit_time,INTERVAL 30 MINUTE),'YYYY-MM-DD HH24:MI:00')
when #{groupType}=3 then TO_CHAR(DATE_ADD(t.unit_time,INTERVAL 60 MINUTE),'YYYY-MM-DD HH24:00:00')
end
) end_time,
cross_id ,
lane_no ,
dir_type ,
turn_type ,
SUM(flow) flow,
round(AVG(speed),2) speed,
MAX(queue_length) max_queue_length,
MIN(queue_length) min_queue_length,
round(AVG(queue_length)) avg_queue_length,
round(AVG(stop_times),2) stop_times,
round(AVG(delay_time),2) delay_time,
round(AVG(traffic_index),2) traffic_index,
round(AVG(sturation),4) sturation,
round(AVG(green_light_efficiency),4) green_light_efficiency,
round(AVG(vehicle_length_ratio_mean),4) vehicle_length_ratio_mean,
group_concat(service_level) service_level
SUM(flow) AS flow,
round(CAST(AVG(speed) AS NUMERIC),2) AS speed,
MAX(queue_length) AS max_queue_length,
MIN(queue_length) AS min_queue_length,
round(CAST(AVG(queue_length) AS NUMERIC)) AS avg_queue_length,
round(CAST(AVG(stop_times) AS NUMERIC),2) AS stop_times,
roundCAST(AVG(delay_time) AS NUMERIC),2) AS delay_time,
round(CAST(AVG(traffic_index) AS NUMERIC),2) AS traffic_index,
round(CAST(AVG(sturation) AS NUMERIC),4) AS sturation,
round(CAST(AVG(green_light_efficiency) AS NUMERIC),4) AS green_light_efficiency,
round(CAST(AVG(vehicle_length_ratio_mean) AS NUMERIC),4) AS vehicle_length_ratio_mean,
STRING_AGG(service_level||'',',') AS service_level
FROM
(
SELECT start_time,
(case
when #{groupType}=0 then DATE_FORMAT(concat( date( start_time ), ' ', HOUR ( start_time ), ':', floor( MINUTE ( start_time ) / 5 ) * 5 ),'%Y-%m-%d %H:%i:00' )
when #{groupType}=1 then DATE_FORMAT(concat( date( start_time ), ' ', HOUR ( start_time ), ':', floor( MINUTE ( start_time ) / 15 ) * 15 ),'%Y-%m-%d %H:%i:00' )
when #{groupType}=2 then DATE_FORMAT(concat( date( start_time ), ' ', HOUR ( start_time ), ':', floor( MINUTE ( start_time ) / 30 ) * 30 ),'%Y-%m-%d %H:%i:00' )
when #{groupType}=3 then DATE_FORMAT(start_time,'%Y-%m-%d %H:00:00' )
when #{groupType}=4 then DATE_FORMAT(start_time,'%Y-%m-%d 00:00:00' )
else DATE_FORMAT(start_time,'%Y-01-01 00:00:00') <!-- 按查询时间范围不分粒度进行聚合处理 -->
when #{groupType}=0 then TO_CHAR(concat( TO_CHAR( start_time,'YYYY-MM-DD' ), ' ', TO_CHAR( start_time,'HH24' ), ':', floor( EXTRACT(MINUTE FROM start_time ) / 5 ) * 5 ),'YYYY-MM-DD HH24:MI:00' )
when #{groupType}=1 then TO_CHAR(concat( TO_CHAR( start_time,'YYYY-MM-DD' ), ' ', TO_CHAR( start_time,'HH24' ), ':', floor( EXTRACT(MINUTE FROM start_time ) / 15 ) * 15 ),'YYYY-MM-DD HH24:MI:00' )
when #{groupType}=2 then TO_CHAR(concat( TO_CHAR( start_time,'YYYY-MM-DD' ), ' ', TO_CHAR( start_time,'HH24' ), ':', floor( EXTRACT(MINUTE FROM start_time ) / 30 ) * 30 ),'YYYY-MM-DD HH24:MI:00' )
when #{groupType}=3 then TO_CHAR(start_time,'YYYY-MM-DD HH24:00:00' )
when #{groupType}=4 then TO_CHAR(start_time,'YYYY-MM-DD 00:00:00' )
else TO_CHAR(start_time,'YYYY-01-01 00:00:00') <!-- 按查询时间范围不分粒度进行聚合处理 -->
end
) unit_time,
t.cross_id,
......@@ -68,7 +68,7 @@
null as lane_no,
null as dir_type,
null as turn_type,
ifnull(service_level,'A') service_level,
COALESCE(service_level,'A') AS service_level,
traffic_index,
green_light_efficiency,
null as vehicle_length_ratio_mean,
......@@ -123,8 +123,8 @@
and t.cross_id = #{crossId}
</if>
<if test="startDate !=null and endDate !=null">
and dt >= date_format(#{startDate},'%Y%m%d') and dt &lt;= date_format(#{endDate},'%Y%m%d')
AND start_time >= #{startDate} and start_time &lt; #{endDate}
and dt >= CAST(TO_CHAR(#{startDate},'YYYYMMDD') AS INT4) and dt &lt;= CAST(TO_CHAR(#{endDate},'YYYYMMDD') AS INT4)
AND start_time >= TO_TIMESTAMP(#{startDate},'YYYY-MM-DD HH24:MI:SS') and start_time &lt; TO_TIMESTAMP(#{endDate},'YYYY-MM-DD HH24:MI:SS')
</if>
<choose>
<!-- 方向级 -->
......
......@@ -16,7 +16,7 @@
FROM
(
SELECT t1.cross_id,t1.event_serial_number,t1.type,
TIMESTAMPDIFF(SECOND,t1.start_time,t1.end_time) duration,
extract(epoch from (t1.end_time - t1.start_time)) duration,
t2.event_id
from t_event_info t1
left JOIN
......@@ -26,7 +26,7 @@
AND t2.cross_id=#{crossId}
</if>
<if test="startTime!=null and endTime!=null">
AND t2.issue_time>=#{startTime} and t2.issue_time &lt;=#{endTime}
AND t2.issue_time>= TO_TIMESTAMP(#{startTime},'YYYY-MM-DD HH24:MI:SS') and t2.issue_time &lt;=TO_TIMESTAMP(#{endTime},'YYYY-MM-DD HH24:MI:SS')
</if>
<if test="currentAlgo!=null and currentAlgo!=''">
AND t2.current_algo=#{currentAlgo}
......@@ -36,7 +36,7 @@
AND t1.cross_id=#{crossId}
</if>
<if test="startTime!=null and endTime!=null">
AND t1.start_time>=#{startTime} and t1.start_time &lt;=#{endTime}
AND t1.start_time>=TO_TIMESTAMP(#{startTime},'YYYY-MM-DD HH24:MI:SS') and t1.start_time &lt;=TO_TIMESTAMP(#{endTime},'YYYY-MM-DD HH24:MI:SS')
</if>
<if test="evenType!=null and evenType!='' ">
AND t1.type=#{evenType}
......@@ -51,7 +51,8 @@
FROM
(
SELECT t1.cross_id,t1.event_serial_number,
t1.type,TIMESTAMPDIFF(SECOND,t1.start_time,t1.end_time) duration,
t1.type,
extract(epoch from (t1.end_time - t1.start_time)) duration,
t2.event_id
from t_event_info t1
left JOIN
......@@ -61,18 +62,18 @@
AND t2.cross_id=#{crossId}
</if>
<if test="contrastStartTime!=null and constrastEndTime!=null">
AND t2.issue_time>=#{contrastStartTime} and t2.issue_time &lt;=#{constrastEndTime}
AND t2.issue_time>= TO_TIMESTAMP(#{contrastStartTime},'YYYY-MM-DD HH24:MI:SS') and t2.issue_time &lt;=TO_TIMESTAMP(#{constrastEndTime},'YYYY-MM-DD HH24:MI:SS')
</if>
<if test="currentAlgo!=null">
AND t2.current_algo=#{currentAlgo}
<if test="currentAlgo!=null">
AND t2.current_algo=#{currentAlgo}
</if>
WHERE
1=1
1=1
<if test="crossId!=null and crossId!=''">
AND t1.cross_id=#{crossId}
</if>
</if>
<if test="contrastStartTime!=null and constrastEndTime!=null">
AND t1.start_time>=#{contrastStartTime} and t1.start_time &lt;=#{constrastEndTime}
AND t1.start_time>=TO_TIMESTAMP(#{contrastStartTime},'YYYY-MM-DD HH24:MI:SS') and t1.start_time &lt;=TO_TIMESTAMP(#{constrastEndTime},'YYYY-MM-DD HH24:MI:SS')
</if>
<if test="evenType!=null">
AND t1.type=#{evenType}
......
......@@ -435,17 +435,18 @@
</sql>
<select id="getListByStartAndEnd" parameterType="java.util.Map" resultType="java.util.Map">
SELECT DATE_FORMAT(start_time,'%Y-%m-%d %H:%i:%s') startTime,
DATE_FORMAT(ifnull(end_time,now()) ,'%Y-%m-%d %H:%i:%s') endTime,
ABS(TIMESTAMPDIFF( SECOND, start_time, ifnull(end_time,now()) )) AS duration,
SELECT TO_CHAR(start_time,'YYYY-MM-DD HH24:MI:SS') startTime,
TO_CHAR(end_time,'YYYY-MM-DD HH24:MI:SS') endTime,
ABS(extract(epoch from (end_time - start_time))) AS duration,
info.type,
c.label as typeName,
dir
FROM t_event_info info
JOIN t_config_event_category c ON info.type = c.event_type
JOIN t_config_event_category c ON info.type = c.event_type
WHERE cross_id = #{crossId}
and start_time BETWEEN #{startTime} AND #{endTime}
<!-- AND end_time is not null -->
and start_time >= TO_TIMESTAMP(#{startTime},'YYYY-MM-DD HH24:MI:SS')
AND end_time &lt; TO_TIMESTAMP(#{endTime},'YYYY-MM-DD HH24:MI:SS')
ORDER BY
start_time DESC
</select>
......
......@@ -7,8 +7,8 @@
FROM t_event_optimize_info
WHERE 1=1
<if test="startTime != null and endTime != null">
AND happen_start_time >= #{startTime}
AND happen_start_time &lt;= #{endTime}
AND happen_start_time >= TO_TIMESTAMP(#{startTime},'YYYY-MM-DD HH24:MI:SS')
AND happen_start_time &lt;= TO_TIMESTAMP(#{endTime},'YYYY-MM-DD HH24:MI:SS')
</if>
<if test="crossId != null">
AND cross_id = #{crossId}
......@@ -73,7 +73,7 @@
<select id="getCrossOptimizeDistribute" parameterType="map" resultType="java.util.Map">
SELECT
(CASE
WHEN #{groupType} = 4 THEN DATE_FORMAT(unit_time, '%Y-%m-%d') -- 按天粒度格式化为 yyyy-MM-dd
WHEN #{groupType} = 4 THEN T0_CHAR(unit_time, 'YYYY-MM-DD') -- 按天粒度格式化为 yyyy-MM-dd
ELSE unit_time -- 其他粒度格式化为 HH:mm
END) AS time_label,
event_type,
......@@ -82,11 +82,11 @@
FROM (
SELECT
(CASE
WHEN #{groupType} = 0 THEN DATE_FORMAT(CONCAT(DATE(happen_start_time), ' ', HOUR(happen_start_time), ':', FLOOR(MINUTE(happen_start_time) / 5) * 5), '%Y-%m-%d %H:%i:00')
WHEN #{groupType} = 1 THEN DATE_FORMAT(CONCAT(DATE(happen_start_time), ' ', HOUR(happen_start_time), ':', FLOOR(MINUTE(happen_start_time) / 15) * 15), '%Y-%m-%d %H:%i:00')
WHEN #{groupType} = 2 THEN DATE_FORMAT(CONCAT(DATE(happen_start_time), ' ', HOUR(happen_start_time), ':', FLOOR(MINUTE(happen_start_time) / 30) * 30), '%Y-%m-%d %H:%i:00')
WHEN #{groupType} = 3 THEN DATE_FORMAT(happen_start_time, '%Y-%m-%d %H:00:00')
WHEN #{groupType} = 4 THEN DATE_FORMAT(happen_start_time, '%Y-%m-%d 00:00:00')
WHEN #{groupType} = 0 THEN TO_CHAR(CONCAT(TO_CHAR(happen_start_time,'YYYY-MM-DD'), ' ', TO_CHAR(happen_start_time,'HH24'), ':', FLOOR(EXTRACT(MINUTE FROM happen_start_time) / 5) * 5), 'YYYY-MM-DD HH24:MI:00')
WHEN #{groupType} = 1 THEN TO_CHAR(CONCAT(TO_CHAR(happen_start_time,'YYYY-MM-DD'), ' ', TO_CHAR(happen_start_time,'HH24'), ':', FLOOR(EXTRACT(MINUTE FROM happen_start_time) / 15) * 15), 'YYYY-MM-DD HH24:MI:00')
WHEN #{groupType} = 2 THEN TO_CHAR(CONCAT(TO_CHAR(happen_start_time,'YYYY-MM-DD'), ' ', TO_CHAR(happen_start_time,'HH24'), ':', FLOOR(EXTRACT(MINUTE FROM happen_start_time) / 30) * 30), 'YYYY-MM-DD HH24:MI:00')
WHEN #{groupType} = 3 THEN TO_CHAR(happen_start_time, 'YYYY-MM-DD HH24:00:00')
WHEN #{groupType} = 4 THEN TO_CHAR(happen_start_time, 'YYYY-MM-DD 00:00:00')
END) AS unit_time,
event_type,
COUNT(*) AS total_count,
......@@ -100,8 +100,8 @@
AND green_id = #{greenId}
</if>
<if test="startTime != null and endTime != null">
AND happen_start_time >= #{startTime}
AND happen_start_time &lt; #{endTime}
AND happen_start_time >= TO_TIMESTAMP(#{startTime},'YYYY-MM-DD HH24:MI:SS'))
AND happen_start_time &lt; TO_TIMESTAMP(#{endTime},'YYYY-MM-DD HH24:MI:SS'))
</if>
GROUP BY unit_time, event_type
) t
......@@ -118,8 +118,8 @@
JOIN t_config_event_category t2 ON t1.event_type=t2.event_type
WHERE 1=1
<if test="startTime != null and endTime != null">
AND happen_start_time >= #{startTime}
AND happen_start_time &lt;= #{endTime}
AND happen_start_time >= TO_TIMESTAMP(#{startTime},'YYYY-MM-DD HH24:MI:SS'))
AND happen_start_time &lt;= TO_TIMESTAMP(#{endTime},'YYYY-MM-DD HH24:MI:SS'))
</if>
<if test="greenId != null and greenId != ''">
AND green_id = #{greenId}
......@@ -156,14 +156,14 @@
current_algo AS event_type,
issue_time AS opt_start_time,
duration AS opt_duration,
DATE_ADD( issue_time, INTERVAL duration SECOND ) AS opt_end_time
control_time + control_duration * interval '1 second' AS opt_end_time
FROM
t_strategy_cross_result
WHERE
1=1
<if test="startTime != null and endTime != null">
AND issue_time >= #{startTime}
AND issue_time &lt; #{endTime}
AND issue_time >= TO_TIMESTAMP(#{startTime},'YYYY-MM-DD HH24:MI:SS'))
AND issue_time &lt; TO_TIMESTAMP(#{endTime},'YYYY-MM-DD HH24:MI:SS'))
</if>
<if test="crossIds != null" >
AND cross_id in
......@@ -180,7 +180,7 @@
a.type as event_type,
a.control_time AS opt_start_time,
a.control_duration AS opt_duration,
DATE_ADD( control_time, INTERVAL control_duration SECOND ) AS opt_end_time
control_time + control_duration * interval '1 second' AS opt_end_time
FROM t_strategy_green_opt_hist a
WHERE
1=1
......@@ -188,8 +188,8 @@
AND green_id = #{greenId}
</if>
<if test="startTime != null and endTime != null">
AND control_time >= #{startTime}
AND control_time &lt; #{endTime}
AND control_time >= TO_TIMESTAMP(#{startTime},'YYYY-MM-DD HH24:MI:SS'))
AND control_time &lt; TO_TIMESTAMP(#{endTime},'YYYY-MM-DD HH24:MI:SS'))
</if>
and control_method in (-1, 1)
</select>
......
......@@ -152,7 +152,7 @@
<select id="greenOptimizeByTimeTrend" parameterType="map" resultType="net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo">
SELECT green_id,
control_time as opt_start_time,
DATE_ADD(control_time,INTERVAL control_duration SECOND) as opt_end_time,
control_time + control_duration * INTERVAL '1 SECOND' as opt_end_time,
control_duration as opt_duration
from t_strategy_green_opt_hist
where 1=1
......@@ -160,8 +160,8 @@
AND green_id= #{greenId}
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
and control_time >= DATE_FORMAT(STR_TO_DATE(#{startTime},'%Y%m%d'),'%Y%m%d000000')
and control_time &lt; DATE_FORMAT(STR_TO_DATE(#{endTime},'%Y%m%d'),'%Y%m%d235959')
and control_time >= TO_TIMESTAMP(TO_CHAR(#{startTime},'YYYY-MM-DD 00:00:00'),'YYYY-MM-DD 00:00:00')
and control_time &lt; TO_TIMESTAMP(TO_CHAR(#{endTime},'YYYY-MM-DD 23:59:59'),'YYYY-MM-DD 23:59:59')
</if>
and control_method=1
GROUP BY green_id, control_time, control_duration, control_method
......
......@@ -24,7 +24,7 @@
<select id="selectGreenDataHist" parameterType="String" resultMap="AnalysisGreenCongestionPeriodMap">
SELECT a.green_id,a.road_direction,a.start_time,a.status FROM t_greenwave_hist a
where a.start_time between DATE_FORMAT(#{date},'%Y-%m-%d 00:00:00') and DATE_FORMAT(#{date},'%Y-%m-%d 23:59:59')
where a.start_time between TO_TIMESTAMP(#{date},'%Y-%m-%d 00:00:00') and TO_TIMESTAMP(#{date},'%Y-%m-%d 23:59:59')
and a.green_id is not null
order by a.green_id,a.road_direction,a.start_time
</select>
......@@ -36,11 +36,11 @@
<insert id="insertGreenCongestionPeriodData" parameterType="map">
insert into t_analysis_green_wave_congest_time_span (green_id,road_direction,week_day,congest_start_time,congest_end_time,congest_index,status,travel_time,speed,peak_type,year_week,week_start_time,week_end_time,insert_time)
SELECT a.green_id,a.road_direction,#{weekDay} as week_day, DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i:%s') as congest_start_time,DATE_FORMAT(DATE_ADD(#{endTime},INTERVAL 5 MINUTE),'%Y-%m-%d %H:%i:%s') as congest_end_time,AVG(traffic_index),#{status} as status,CEIL(AVG(trval_time)),AVG(speed),
#{peakType} as peak_type,#{weekNumber} as year_week,DATE_FORMAT(#{weekStartTime},'%Y-%m-%d') as week_start_time,DATE_FORMAT(#{weekEndTime},'%Y-%m-%d') as week_end_time,now()
SELECT a.green_id,a.road_direction,#{weekDay} as week_day, TO_TIMESTEMP(#{startTime},'%Y-%m-%d %H:%i:%s') as congest_start_time,TO_TIMESTAMP(DATE_ADD(#{endTime},INTERVAL 5 MINUTE),'%Y-%m-%d %H:%i:%s') as congest_end_time,AVG(traffic_index),#{status} as status,CEIL(AVG(trval_time)),AVG(speed),
#{peakType} as peak_type,#{weekNumber} as year_week,TO_TIMESTAMP(#{weekStartTime},'%Y-%m-%d') as week_start_time,TO_TIMESTAMP(#{weekEndTime},'%Y-%m-%d') as week_end_time,now()
FROM t_greenwave_hist a
where a.start_time between DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i:%s') and DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i:%s')
and a.green_id = #{greenId}
where a.start_time between TO_TIMESTAMP(#{startTime},'%Y-%m-%d %H:%i:%s') and TO_TIMESTAMP(#{endTime},'%Y-%m-%d %H:%i:%s')
and CAST(a.green_id AS VARCHAR) = #{greenId}
and a.road_direction = #{roadDirection}
</insert>
......@@ -48,7 +48,7 @@
select t.green_id,t1.key_cross_id as cross_id, t1.road_direction,t1.dir,t1.turn,t.start_time,t.traffic_index
from t_greenwave_hist t
left join t_greenwave_key_cross_lane t1 on t.green_id = t1.green_id and t.road_direction = t1.road_direction
where t.start_time BETWEEN DATE_FORMAT(#{date},'%Y-%m-%d 00:00:00') and DATE_FORMAT(#{date},'%Y-%m-%d 23:59:59')
where t.start_time BETWEEN TO_TIMESTAMP(#{date},'%Y-%m-%d 00:00:00') and TO_TIMESTAMP(#{date},'%Y-%m-%d 23:59:59')
and t1.dir is not null
order by t.green_id,t1.road_direction,t1.dir,t1.turn,t.start_time
</select>
......@@ -56,8 +56,8 @@
<select id="selectGreenTrafficThreshold" parameterType="String" resultMap="AnalysisLaneDataHistMap">
select t.green_id,t.traffic_index
from t_greenwave_hist t
where t.start_time BETWEEN DATE_FORMAT(#{date},'%Y-%m-%d 09:00:00') and DATE_FORMAT(#{date},'%Y-%m-%d 16:30:10')
and t.green_id = #{greenId}
where t.start_time BETWEEN TO_TIMESTAMP(#{date},'%Y-%m-%d 09:00:00') and TO_TIMESTAMP(#{date},'%Y-%m-%d 16:30:10')
and CAST(t.green_id AS VARCHAR) = #{greenId}
and t.road_direction = #{roadDirection}
order by t.traffic_index desc
</select>
......@@ -69,9 +69,9 @@
(select t.id , t1.key_cross_id from t_base_lane_info t
left join t_greenwave_key_cross_lane t1 on t1.key_cross_id = t.cross_id and t1.dir = t.dir
where t1.key_cross_id is not null and t.type = 2) t3 on t2.id = t3.id
where t3.key_cross_id is not null and dt = #{date} ) t4
where t3.key_cross_id is not null and dt = CAST(#{date} AS INT4) ) t4
where t4.cross_id = #{crossId}
and t4.start_time between DATE_FORMAT(DATE_SUB(#{startTime},INTERVAL 10 MINUTE),'%Y-%m-%d %H:%i:00') and DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i:%s')
and t4.start_time between TO_TIMESTAMP(DATE_SUB(#{startTime},INTERVAL 10 MINUTE),'%Y-%m-%d %H:%i:00') and TO_TIMESTAMP(#{endTime},'%Y-%m-%d %H:%i:%s')
group by t4.cross_id,t4.start_time
</select>
......@@ -79,13 +79,13 @@
insert into t_analysis_green_wave_peak_detail (green_id,road_direction,week_day,peak_start_time,peak_end_time,
traffic_index,travel_time,speed,flow,max_flow,peak_type,year_week,week_start_time,week_end_time,insert_time,traffic_threshold )
select a.green_id,a.road_direction,#{weekDay} as week_day,DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i:%s') as peak_start_time,
DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i:%s') as peak_end_time, AVG(traffic_index),CEIL(AVG(trval_time)),AVG(speed),
#{avgFlow} as flow,#{maxFlow} as max_flow,#{peakType} as peak_type,#{weekNumber} as year_week,DATE_FORMAT(#{weekStartTime},'%Y-%m-%d') as week_start_time,
DATE_FORMAT(#{weekEndTime},'%Y-%m-%d') as week_end_time,now(),#{trafficThreshold} as traffic_threshold
select a.green_id,a.road_direction,#{weekDay} as week_day,TO_TIMESTAMP(#{startTime},'%Y-%m-%d %H:%i:%s') as peak_start_time,
TO_TIMESTAMP(#{endTime},'%Y-%m-%d %H:%i:%s') as peak_end_time, AVG(traffic_index),CEIL(AVG(trval_time)),AVG(speed),
#{avgFlow} as flow,#{maxFlow} as max_flow,#{peakType} as peak_type,#{weekNumber} as year_week,TO_TIMESTAMP(#{weekStartTime},'%Y-%m-%d') as week_start_time,
TO_TIMESTAMP(#{weekEndTime},'%Y-%m-%d') as week_end_time,now(),#{trafficThreshold} as traffic_threshold
from t_greenwave_hist a
where DATE_FORMAT(a.start_time,'%Y-%m-%d %H:%i:00') between DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i:%s') and DATE_FORMAT(DATE_SUB(#{endTime},INTERVAL 5 MINUTE),'%Y-%m-%d %H:%i:%s')
and a.green_id = #{greenId}
where TO_TIMESTAMP(a.start_time,'%Y-%m-%d %H:%i:00') between TO_TIMESTAMP(#{startTime},'%Y-%m-%d %H:%i:%s') and TO_TIMESTAMP(DATE_SUB(#{endTime},INTERVAL 5 MINUTE),'%Y-%m-%d %H:%i:%s')
and CAST(a.green_id AS VARCHAR) = #{greenId}
and a.road_direction = #{roadDirection}
</insert>
......@@ -93,7 +93,7 @@
select t.green_id,t1.key_cross_id as cross_id, t.road_direction,t.peak_start_time as start_time,t.peak_end_time as endTime ,t.traffic_index,t.peak_type
from t_analysis_green_wave_peak_detail t
left join t_greenwave_key_cross_lane t1 on t1.green_id = t.green_id
where t.peak_start_time BETWEEN DATE_FORMAT(#{date},'%Y-%m-%d 00:00:00') and DATE_FORMAT(#{date},'%Y-%m-%d 23:59:59')
where t.peak_start_time BETWEEN TO_TIMESTAMP(#{date},'%Y-%m-%d 00:00:00') and TO_TIMESTAMP(#{date},'%Y-%m-%d 23:59:59')
order by t.green_id,t1.key_cross_id ,t.road_direction,t.peak_type,t.traffic_index desc
</select>
......
......@@ -24,30 +24,30 @@
<select id="selectCrossEvent" resultMap="AnalysisProblemAndStrategyDayMap">
select a.event_serial_number as eventSerialNumber , a.cross_id as crossId ,a.green_id as greenId,
a.category as eventCategory,a.type as eventType ,a.start_time as happenStartTime ,a.end_time as happenEndTime,
TIMESTAMPDIFF(SECOND, a.start_time , a.end_time) as duration , a.dir
from t_event_info a where a.dt = DATE_FORMAT(DATE_sub(now(),INTERVAL 24 HOUR ),'%Y%m%d') and a.type in (701,702,703,707)
extract(epoch from (a.end_time - a.start_time )) as duration , a.dir
from t_event_info a where a.dt = CAST(TO_CHAR(DATE_sub(now(),INTERVAL 24 HOUR ),'%Y%m%d') as INT4) and a.type in ('701','702','703','707')
</select>
<select id="selectGreenEvent" resultMap="AnalysisProblemAndStrategyDayMap">
select a.event_serial_number as eventSerialNumber , a.cross_id as crossId ,a.green_id as greenId,
a.category as eventCategory,a.type as eventType ,a.start_time as happenStartTime ,a.end_time as happenEndTime,
TIMESTAMPDIFF(SECOND, a.start_time , a.end_time) as duration , a.dir
from t_event_info a where a.dt = DATE_FORMAT(DATE_sub(now(),INTERVAL 24 HOUR ),'%Y%m%d') and a.type in (705,706)
extract(epoch from (a.end_time - a.start_time )) as duration , a.dir
from t_event_info a where a.dt = CAST(TO_CHAR(DATE_sub(now(),INTERVAL 24 HOUR ),'%Y%m%d') as INT4) and a.type in ('705','706')
</select>
<select id="getGreenStrategy" parameterType="String" resultMap="AnalysisProblemAndStrategyDayMap">
select DISTINCT a.control_time as optStartTime,DATE_ADD(a.control_time,INTERVAL a.control_duration SECOND ) as optEndTime ,a.control_duration as optDuration from t_strategy_green_opt_hist a
select DISTINCT a.control_time as optStartTime,a.control_time + a.control_duration* interval '1 second' as optEndTime ,a.control_duration as optDuration from t_strategy_green_opt_hist a
where a.control_time = (select MAX(control_time) from t_strategy_green_opt_hist where green_id = #{greenID}
and control_time <![CDATA[ >= ]]> DATE_FORMAT(DATE_sub(#{time},INTERVAL control_duration SECOND),'%Y-%m-%d %H:%i:%s') and control_time <![CDATA[ <= ]]> DATE_FORMAT(#{time}, '%Y-%m-%d %H:%i:%s')
and control_time <![CDATA[ >= ]]> TO_TIMESTAMP( #{time} - control_duration* interval '1 second','%Y-%m-%d %H:%i:%s') and control_time <![CDATA[ <= ]]> TO_TIMESTAMP(#{time}, '%Y-%m-%d %H:%i:%s')
and response_code = 200 )
and a.green_id = #{greenID}
</select>
<select id="getCrossStrategy" parameterType="String" resultMap="AnalysisProblemAndStrategyDayMap">
select a.issue_time as optStartTime,DATE_ADD(a.issue_time,INTERVAL a.duration SECOND ) as optEndTime,a.duration as optDuration from t_strategy_cross_result a
select a.issue_time as optStartTime,a.issue_time + a.control_duration* interval '1 second' as optEndTime,a.duration as optDuration from t_strategy_cross_result a
where a.event_id = #{eventSerialNumber}
and response_code = 200
and dt = DATE_FORMAT(#{time}, '%Y%m%d')
and dt = CAST(TO_CHAR(#{time}, '%Y%m%d') AS INT4)
and a.cross_id = #{crossID}
</select>
......
......@@ -12,12 +12,12 @@
WHERE
1 = 1
<if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt;= #{endTime}
and dt >= CAST(TO_CHAR(#{startTime},'YYYYMMDD') AS INT4) AND dt &lt;= CAST(TO_CHAR(#{endTime},'YYYYMMDD') AS INT4)
</if>
<if test="areaId != null and areaId != ''">
and tapcd.area_id = #{areaId}
</if>
and tapcd.event_type != 708
and tapcd.event_type != '708'
GROUP BY tapcd.event_type
union
SELECT sum(event_number) as event_number,
......@@ -28,7 +28,7 @@
WHERE
1 = 1
<if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt;= #{endTime}
and dt >= CAST(TO_CHAR(#{startTime},'YYYYMMDD') AS INT4) AND dt &lt;= CAST(TO_CHAR(#{endTime},'YYYYMMDD') AS INT4)
</if>
<if test="areaId != null and areaId != ''">
and tapcd.area_id = #{areaId}
......@@ -49,7 +49,7 @@
WHERE
1 = 1
<if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt;= #{endTime}
and dt >= CAST(TO_CHAR(#{startTime},'YYYYMMDD') AS INT4) AND dt &lt;= CAST(TO_CHAR(#{endTime},'YYYYMMDD') AS INT4)
</if>
<if test="areaId != null and areaId != ''">
and t1.area_id = #{areaId}
......@@ -68,7 +68,7 @@
WHERE
1 = 1
<if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt;= #{endTime}
and dt >= CAST(TO_CHAR(#{startTime},'YYYYMMDD') AS INT4) AND dt &lt;= CAST(TO_CHAR(#{endTime},'YYYYMMDD') AS INT4)
</if>
<if test="areaId != null and areaId != ''">
and t1.area_id = #{areaId}
......@@ -90,7 +90,7 @@
WHERE
1 = 1
<if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt;= #{endTime}
and dt >= CAST(TO_CHAR(#{startTime},'YYYYMMDD') AS INT4) AND dt &lt;= CAST(TO_CHAR(#{endTime},'YYYYMMDD') AS INT4)
</if>
<if test="eventType != null and eventType != ''">
and t1.event_type = #{eventType}
......@@ -115,7 +115,7 @@
WHERE
1 = 1
<if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt;= #{endTime}
and dt >= CAST(TO_CHAR(#{startTime},'YYYYMMDD') AS INT4) AND dt &lt;= CAST(TO_CHAR(#{endTime},'YYYYMMDD') AS INT4)
</if>
<if test="eventType != null and eventType != ''">
and t1.event_type = #{eventType}
......
......@@ -209,11 +209,11 @@
<!-- 新增表t_analysis_problem_cross_day信息 -->
<insert id="insertAnalysisProblemCrossDay">
insert into t_analysis_problem_cross_day (id,cross_id,area_id,event_category,event_type,event_number,event_total_time,dt,insert_time)
select UUID(), a.cross_id, b.area_id,a.category,a.type,count(1) as event_number , sum( TIMESTAMPDIFF(SECOND, a.start_time , a.end_time) ) as duration ,
DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y%m%d') as dt , now()
select uuid_generate_v4() as id, a.cross_id, b.area_id,a.category,a.type,count(1) as event_number , sum( extract(epoch from (a.end_time - a.start_time)) ) as duration ,
TO_TIMESTAMP(DATE_SUB(now(),INTERVAL 1 DAY),'%Y%m%d') as dt , now()
from t_event_info a
left join t_base_cross_info b on a.cross_id = b.id
where DATE_FORMAT(a.start_time,'%Y-%m-%d') = DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y-%m-%d') and a.type in (701,702,703,707)
where TO_TIMESTAMP(a.start_time,'%Y-%m-%d') = TO_TIMESTAMP(DATE_SUB(now(),INTERVAL 1 DAY),'%Y-%m-%d') and a.type in ('701','702','703','707')
group by a.cross_id, b.area_id,a.category,a.type
ON DUPLICATE KEY UPDATE
id=VALUES(id),
......@@ -271,7 +271,7 @@
<select id="checkData" resultMap="AnalysisProblemCrossDayMap">
SELECT dt
FROM t_analysis_problem_cross_day
WHERE dt = DATE_FORMAT(DATE_SUB(now(),INTERVAL 1 DAY),'%Y%m%d')
WHERE dt = CAST(TO_CHAR(DATE_SUB(now(),INTERVAL 1 DAY),'YYYYMMDD') AS INT4 )
</select>
<select id="selectCountByType" parameterType="map" resultMap="AnalysisProblemCrossDayMap">
......@@ -283,7 +283,7 @@
WHERE
1 = 1
<if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt;= #{endTime}
and dt >= CAST(TO_CHAR(#{startTime},'YYYYMMDD') AS INT4) AND dt &lt;= CAST(TO_CHAR(#{endTime},'YYYYMMDD') AS INT4)
</if>
<if test="areaId != null and areaId != ''">
and tapcd.area_id = #{areaId}
......@@ -298,7 +298,7 @@
WHERE
1 = 1
<if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt;= #{endTime}
and dt >= CAST(TO_CHAR(#{startTime},'YYYYMMDD') AS INT4) AND dt &lt;= CAST(TO_CHAR(#{endTime},'YYYYMMDD') AS INT4)
</if>
<if test="areaId != null and areaId != ''">
and tapcd.area_id = #{areaId}
......@@ -316,12 +316,12 @@
WHERE
1 = 1
<if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt;= #{endTime}
and dt >= CAST(TO_CHAR(#{startTime},'YYYYMMDD') AS INT4) AND dt &lt;= CAST(TO_CHAR(#{endTime},'YYYYMMDD') AS INT4)
</if>
<if test="crossId!=null and crossId!=''">
and tapcd.cross_id = #{crossId}
</if>
and tapcd.event_type != 708
and tapcd.event_type != '708'
GROUP BY tapcd.event_type
</select>
......@@ -337,12 +337,12 @@
WHERE
1 = 1
<if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt;= #{endTime}
and dt >= CAST(TO_CHAR(#{startTime},'YYYYMMDD') AS INT4) AND dt &lt;= CAST(TO_CHAR(#{endTime},'YYYYMMDD') AS INT4)
</if>
<if test="crossId != null and crossId != ''">
and t1.cross_id = #{crossId}
</if>
and t1.event_type != 708
and t1.event_type != '708'
GROUP BY dt, t1.event_type
ORDER BY dt
</select>
......@@ -362,9 +362,9 @@
and t.cross_id = #{crossID}
</if>
<if test="greenId !=null and greenId !=''">
and t.green_id = #{greenId}
and t.green_id = CAST(#{greenId} AS INT4)
</if>
and t.dt >= date_format(#{startTime},'%Y%m%d') and t.dt &lt;= date_format(#{endTime},'%Y%m%d')
and t.dt >= CAST(TO_CHAR(#{startTime},'YYYYMMDD') AS INT4) AND t.dt &lt;= CAST(TO_CHAR(#{endTime},'YYYYMMDD') AS INT4)
group by status
</select>
<select id="getTrunkLineCrossProblem" resultType="net.wanji.opt.vo2.GreenwaveCrossResult">
......@@ -382,10 +382,10 @@
WHERE
1=1
<if test="startTime != null and endTime != null">
and start_time BETWEEN #{startTime} AND #{endTime}
and start_time BETWEEN TO_TIMESTAMP(#{startTime},'YYYY-MM-DD HH24:MI:SS') AND TO_TIMESTAMP(#{endTime},'YYYY-MM-DD HH24:MI:SS')
</if>
<if test="greenId != null">
and green_id = #{greenId}
and green_id = CAST(#{greenId} AS INT4)
</if>
GROUP BY cross_id, dir_type, status
</select>
......@@ -395,10 +395,10 @@
select COALESCE(AVG(stop_times), 0) stop_time from t_greenwave_hist
where 1=1
<if test="greenId != null">
green_id = #{greenId}
green_id = CAST(#{greenId} AS INT4)
</if>
<if test="startTime != null and endTime != null">
and start_time BETWEEN #{startTime} AND #{endTime}
and start_time BETWEEN TO_TIMESTAMP(#{startTime},'YYYY-MM-DD HH24:MI:SS') AND TO_TIMESTAMP(#{endTime},'YYYY-MM-DD HH24:MI:SS')
</if>
and status in (3,4)
</select>
......@@ -406,10 +406,10 @@
select COALESCE(sum(stop_times), 0) stop_time from t_greenwave_hist
where 1=1
<if test="greenId != null">
green_id = #{greenId}
green_id = CAST(#{greenId} AS INT4)
</if>
<if test="startTime != null and endTime != null">
and start_time BETWEEN #{startTime} AND #{endTime}
and start_time BETWEEN TO_TIMESTAMP(#{startTime},'YYYY-MM-DD HH24:MI:SS') AND TO_TIMESTAMP(#{endTime},'YYYY-MM-DD HH24:MI:SS')
</if>
and status in (3,4)
</select>
......@@ -417,10 +417,10 @@
select COALESCE(sum(stop_times), 0) stop_time from t_greenwave_hist
where 1=1
<if test="greenId != null">
green_id = #{greenId}
green_id = CAST(#{greenId} AS INT4)
</if>
<if test="startTime != null and endTime != null">
and start_time BETWEEN #{startTime} AND #{endTime}
and start_time BETWEEN TO_TIMESTAMP(#{startTime},'YYYY-MM-DD HH24:MI:SS') AND TO_TIMESTAMP(#{endTime},'YYYY-MM-DD HH24:MI:SS')
</if>
and status = 2
</select>
......@@ -431,7 +431,7 @@
LEFT JOIN
(
SELECT id,sturation from t_lane_data_hist
where cross_id = #{crossId} and start_time BETWEEN #{startTime} AND #{endTime}
where cross_id = #{crossId} and start_time BETWEEN TO_TIMESTAMP(#{startTime},'YYYY-MM-DD HH24:MI:SS') AND TO_TIMESTAMP(#{endTime},'YYYY-MM-DD HH24:MI:SS')
) b
on a.id=b.id
where a.cross_id = #{crossId} and a.type=2
......
......@@ -186,7 +186,7 @@
WHERE
1=1
<if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt;= #{endTime}
and dt >= CAST(TO_CHAR(#{startTime},'YYYYMMDD') AS INT4) AND dt &lt;= CAST(TO_CHAR(#{endTime},'YYYYMMDD') AS INT4)
</if>
<if test="crossId != null and crossId != ''">
and t1.cross_id = #{crossId}
......@@ -204,8 +204,8 @@
turn,
t1.cross_id,
sum(event_number)AS event_number ,
DATE_FORMAT(t1.window_start_time,'%H:%i') AS hours_window_start_time ,
DATE_FORMAT(t1.window_start_time, '%Y-%m-%d %H:%i:%s') AS winStartTime,
TO_CHAR(t1.window_start_time,'HH24:MI') AS hours_window_start_time ,
TO_CHAR(t1.window_start_time, 'YYYY-MM-DD HH24:MI:SS') AS winStartTime,
t1.event_type,
t2.label AS typeName
FROM t_analysis_problem_cross_dir_hour t1
......@@ -213,7 +213,7 @@
WHERE
1=1
<if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt;= #{endTime}
and dt >= CAST(TO_CHAR(#{startTime},'YYYYMMDD') AS INT4) AND dt &lt;= CAST(TO_CHAR(#{endTime},'YYYYMMDD') AS INT4)
</if>
<if test="crossId != null and crossId != ''">
and t1.cross_id = #{crossId}
......@@ -222,7 +222,7 @@
and t1.event_type = #{eventType}
</if>
GROUP BY
DATE_FORMAT(t1.window_start_time,'%H:%i')
TO_CHAR(t1.window_start_time,'%H:%i')
ORDER BY event_number desc
limit 1
</select>
......@@ -233,7 +233,7 @@
dir,
t1.cross_id,
sum(event_number)AS event_number ,
DATE_FORMAT(t1.window_start_time,'%H:%i') ,
TO_CHAR(t1.window_start_time,'HH24:MI') ,
t1.event_type,
t2.label AS typeName
FROM t_analysis_problem_cross_dir_hour t1
......@@ -241,7 +241,7 @@
WHERE
1=1
<if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt;= #{endTime}
and dt >= CAST(TO_CHAR(#{startTime},'YYYYMMDD') AS INT4) AND dt &lt;= CAST(TO_CHAR(#{endTime},'YYYYMMDD') AS INT4)
</if>
<if test="crossId != null and crossId != ''">
and t1.cross_id = #{crossId}
......@@ -259,14 +259,14 @@
cross_id,overflow_dir,out_flow_sum,out_flow_avg,next_cross_lane_num,
next_cross_capacity,length_to_next_cross,overflow_num,
dt,
DATE_FORMAT(t1.overflow_start_time,'%H:%i') as overflowStartTimeHours,
DATE_FORMAT(t1.overflow_end_time,'%H:%i') as overflowEndTimeHours
TO_CHAR(t1.overflow_start_time,'HH24:MI') as overflowStartTimeHours,
TO_CHAR(t1.overflow_end_time,'HH24:MI') as overflowEndTimeHours
FROM t_analysis_cross_overflow_reason t1
WHERE
1=1
<if test="startTime != null and endTime != ''">
and t1.dt >= #{startTime} AND t1.dt &lt;= #{endTime}
and t1.dt >= CAST(TO_CHAR(#{startTime},'YYYYMMDD') AS INT4) AND t1.dt &lt;= CAST(TO_CHAR(#{endTime},'YYYYMMDD') AS INT4)
</if>
<if test="crossId != null and crossId != ''">
and t1.cross_id = #{crossId}
......@@ -289,7 +289,7 @@
and t1.turn_type = #{turn}
</if>
<if test="startTimeAll != null and endTimeALL != ''">
and t1.start_time >= #{startTimeAll} AND t1.start_time &lt;= #{endTimeALL}
and t1.start_time >= TO_TIMESTAMP(#{startTimeAll},'YYYY-MM-DD HH24:MI:SS') AND t1.start_time &lt;= TO_TIMESTAMP(#{endTimeALL},'YYYY-MM-DD HH24:MI:SS')
</if>
</select>
......@@ -305,8 +305,8 @@
turn,
t1.cross_id,
event_number,
DATE_FORMAT(t1.window_start_time,'%H:%i') AS hours_window_start_time ,
DATE_FORMAT(t1.window_start_time, '%Y-%m-%d %H:%i:%s') AS winStartTime,
TO_CHAR(t1.window_start_time,'HH24:MI') AS hours_window_start_time ,
TO_CHAR(t1.window_start_time, 'YYYY-MM-DD HH24:MI:SS') AS winStartTime,
t1.event_type,
t2.label AS typeName
FROM t_analysis_problem_cross_dir_hour t1
......@@ -314,7 +314,7 @@
WHERE
1=1
<if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt;= #{endTime}
and dt >= CAST(TO_CHAR(#{startTime},'YYYYMMDD') AS INT4) AND dt &lt;= CAST(TO_CHAR(#{endTime},'YYYYMMDD') AS INT4)
</if>
<if test="crossId != null and crossId != ''">
and t1.cross_id = #{crossId}
......@@ -341,7 +341,7 @@
and t1.cross_id = #{crossId}
</if>
<if test="moningPeakStartAll != null and moningPeakEndAll != null ">
and t1.start_time >= #{moningPeakStartAll} AND t1.start_time &lt;= #{moningPeakEndAll}
and t1.start_time >= TO_TIMESTAMP(#{moningPeakStartAll},'YYYY-MM-DD HH24:MI:SS') AND t1.start_time &lt;= TO_TIMESTAMP(#{moningPeakEndAll},'YYYY-MM-DD HH24:MI:SS')
</if>
</select>
......@@ -352,8 +352,8 @@
turn,
t1.cross_id,
event_number,
DATE_FORMAT(t1.window_start_time,'%H:%i') AS hours_window_start_time ,
DATE_FORMAT(t1.window_start_time, '%Y-%m-%d %H:%i:%s') AS winStartTime,
TO_CHAR(t1.window_start_time,'HH24:MI') AS hours_window_start_time ,
TO_CHAR(t1.window_start_time, 'YYYY-MM-DD HH24:MI:SS') AS winStartTime,
t1.event_type,
t2.label AS typeName
FROM t_analysis_problem_cross_dir_hour t1
......@@ -361,7 +361,7 @@
WHERE
1=1
<if test="startTime != null and endTime != ''">
and dt >= #{startTime} AND dt &lt;= #{endTime}
and dt >= CAST(TO_CHAR(#{startTime},'YYYYMMDD') AS INT4) AND dt &lt;= CAST(TO_CHAR(#{endTime},'YYYYMMDD') AS INT4)
</if>
<if test="crossId != null and crossId != ''">
and t1.cross_id = #{crossId}
......@@ -386,7 +386,7 @@
</if>
<if test="startTimeAll != null and endTimeALL != ''">
and start_time BETWEEN #{startTimeAll} AND #{endTimeALL}
and start_time BETWEEN TO_TIMESTAMP(#{startTimeAll},'YYYY-MM-DD HH24:MI:SS') AND TO_TIMESTAMP(#{endTimeALL},'YYYY-MM-DD HH24:MI:SS')
</if>
) b
on a.id=b.id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment