Commit 79450144 authored by zhoushiguang's avatar zhoushiguang

SQL优化

parent 8fa379ad
...@@ -260,6 +260,7 @@ ...@@ -260,6 +260,7 @@
round(AVG(queue_length)) avg_queue_length, round(AVG(queue_length)) avg_queue_length,
round(AVG(stop_times),2) stop_times, round(AVG(stop_times),2) stop_times,
round(AVG(delay_time),2) delay_time, round(AVG(delay_time),2) delay_time,
round(AVG(traffic_index),2) traffic_index,
round(AVG(sturation),4) sturation, round(AVG(sturation),4) sturation,
group_concat(service_level) service_level group_concat(service_level) service_level
FROM FROM
...@@ -282,6 +283,7 @@ ...@@ -282,6 +283,7 @@
null as lane_no, null as lane_no,
null as turn_type, null as turn_type,
null as service_level, null as service_level,
traffic_index,
</when> </when>
<!-- 转向级 --> <!-- 转向级 -->
<when test="objectType==2"> <when test="objectType==2">
...@@ -289,6 +291,7 @@ ...@@ -289,6 +291,7 @@
t.turn_type, t.turn_type,
null as lane_no, null as lane_no,
null as service_level, null as service_level,
traffic_index,
</when> </when>
<!-- 车道级 --> <!-- 车道级 -->
<when test="objectType==3"> <when test="objectType==3">
...@@ -296,6 +299,7 @@ ...@@ -296,6 +299,7 @@
t2.dir as dir_type, t2.dir as dir_type,
t2.turn as turn_type, t2.turn as turn_type,
null as service_level, null as service_level,
null as traffic_index,
</when> </when>
<!-- 路口级 --> <!-- 路口级 -->
<when test="objectType==4"> <when test="objectType==4">
...@@ -303,6 +307,7 @@ ...@@ -303,6 +307,7 @@
null as dir_type, null as dir_type,
null as turn_type, null as turn_type,
ifnull(service_level,'A') service_level, ifnull(service_level,'A') service_level,
traffic_index,
</when> </when>
<otherwise> <otherwise>
</otherwise> </otherwise>
...@@ -339,7 +344,8 @@ ...@@ -339,7 +344,8 @@
and t.cross_id = #{crossId} and t.cross_id = #{crossId}
</if> </if>
<if test="startDate !=null and endDate !=null"> <if test="startDate !=null and endDate !=null">
AND start_time >= #{startDate} and start_time &lt; #{endDate} <!-- AND start_time >= #{startDate} and start_time &lt; #{endDate} -->
and batch_time between UNIX_TIMESTAMP(#{startDate}) and UNIX_TIMESTAMP(#{endDate})
</if> </if>
) t ) t
<choose> <choose>
......
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