Commit 114ff730 authored by duwei's avatar duwei

sql调整

parent 6489a092
......@@ -81,8 +81,8 @@
<select id="selectByCrossIdTurn" resultType="net.wanji.databus.vo.CrossTurnDataHistVO">
SELECT
t1.cross_id AS crossId,
t1.in_dir AS inDir,
t1.turn_type AS turnType,
t2.in_dir AS inDir,
t2.turn_type AS turnType,
<choose>
<!-- 小时 -->
......@@ -117,20 +117,22 @@
FROM
t_base_cross_turn_info t1
LEFT JOIN t_cross_turn_data_hist t2 ON t1.cross_id = t2.cross_id
and t1.in_dir = t2.in_dir
and t1.turn_type = t2.turn_type
WHERE
1 = 1
<if test="crossId != null">
AND t1.cross_id = #{crossId}
AND t2.cross_id = #{crossId}
</if>
<if test="inDirList != null">
AND t1.in_dir IN
AND t2.in_dir IN
<foreach item="inDir" index="index" collection="inDirList"
open="(" separator="," close=")">
#{inDir}
</foreach>
</if>
<if test="turnTypeList != null">
AND t1.turn_type IN
AND t2.turn_type IN
<foreach item="turnType" index="index" collection="turnTypeList"
open="(" separator="," close=")">
#{turnType}
......@@ -140,13 +142,13 @@
and t2.start_time <![CDATA[ <= ]]> #{endStamp}
GROUP BY
t1.cross_id,
t1.in_dir,
t1.turn_type,
t2.in_dir,
t2.turn_type,
startTime
ORDER BY
t2.start_time asc,
t1.in_dir,
t1.turn_type
startTime asc,
t2.in_dir,
t2.turn_type
</select>
<select id="selectMetricHistDTO" resultType="net.wanji.databus.dto.MetricHistDTO">
......
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