|
@@ -5,45 +5,40 @@
|
|
|
<select id="vehicleTreelist" resultType="com.ozs.entity.vo.BaseVehicleTerminalDto"
|
|
|
parameterType="com.ozs.entity.vo.VehicleTreeVo">
|
|
|
SELECT
|
|
|
- a.id AS id,
|
|
|
- l.railway_code AS railwayCode,
|
|
|
- a.terminal_code AS terminalCode,
|
|
|
- l.vehicle_code AS vehicleCode,
|
|
|
- l.line_dir AS lineDir,
|
|
|
- l.travel_mile AS travelMile,
|
|
|
- l.terminal_longitude as terminalLongitude,
|
|
|
- l.terminal_latitude as terminalLatitude,
|
|
|
- l.curren_time
|
|
|
+ vp.railway_code AS railwayCode,
|
|
|
+ vp.vehicle_code AS vehicleCode,
|
|
|
+ vp.line_dir AS lineDir,
|
|
|
+ vp.travel_mile AS travelMile,
|
|
|
+ vp.terminal_longitude AS terminalLongitude,
|
|
|
+ vp.terminal_latitude AS terminalLatitude,
|
|
|
+ vp.curren_time,
|
|
|
+ vp.terminal_code AS terminalCode,
|
|
|
+ vp.id
|
|
|
+ FROM
|
|
|
+ vehicle_position vp
|
|
|
+ WHERE
|
|
|
+ vp.id IN (
|
|
|
+ SELECT
|
|
|
+ df.id
|
|
|
FROM
|
|
|
- base_vehicle_terminal AS a ,
|
|
|
(
|
|
|
- select * from vehicle_position AS gb_vp where gb_vp.terminal_code in(
|
|
|
- select vp.terminal_code
|
|
|
- from vehicle_position vp
|
|
|
- where not exists (
|
|
|
- select 1
|
|
|
- from vehicle_position df
|
|
|
- <where>
|
|
|
- df.curren_time IS NOT NULL
|
|
|
- <if test="terminalCodeList != null and terminalCodeList.size != 0 ">
|
|
|
- and df.vehicle_code in
|
|
|
- <foreach collection="terminalCodeList" item="item" index="index"
|
|
|
- separator="," open="(" close=")">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- and df.vehicle_code = vp.vehicle_code
|
|
|
- and df.curren_time > vp.curren_time
|
|
|
- </where>
|
|
|
- )
|
|
|
- GROUP BY vp.terminal_code ) ) AS l
|
|
|
+ SELECT
|
|
|
+ id,
|
|
|
+ curren_time,
|
|
|
+ ROW_NUMBER() OVER ( PARTITION BY vehicle_code ORDER BY curren_time DESC ) AS rn
|
|
|
+ FROM
|
|
|
+ vehicle_position
|
|
|
<where>
|
|
|
- a.terminal_code=l.terminal_code
|
|
|
<if test="railwayCode != null and railwayCode !=''">
|
|
|
and l.railway_code like concat("%",#{railwayCode},"%")
|
|
|
</if>
|
|
|
</where>
|
|
|
- ORDER BY l.curren_time DESC
|
|
|
+ ) df
|
|
|
+ WHERE
|
|
|
+ df.rn = 1
|
|
|
+ )
|
|
|
+ ORDER BY
|
|
|
+ vp.curren_time DESC;
|
|
|
</select>
|
|
|
|
|
|
<select id="list" resultType="com.ozs.entity.vo.BaseCameraManagementDto"
|