and (td.source=1) and speed>0 and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or (timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 360)
and (td.source=1) and speed>0 and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or (timestampdiff(SECOND,tdl.last_bs_time,now()))
<![CDATA[<]]> 360)
</when>
<whentest="deviceState == 1"><!-- 静止-->
and (td.source=1) and (speed=0 or speed is null) and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or
...
...
@@ -506,17 +574,25 @@
tv.vehicle_type vehicleType,
tv.vehicle_usages vehicleUsages,
tvd.created_date activateTime,
ddf.`status` AS freqStatus ,
tv.created_by as createdBy,
tu.username creator
ddf.`status` AS freqStatus,
LEFT(ddf.created_date, 19) AS freqTime,
ddf.freq_type AS freqType,
TIMESTAMPDIFF(DAY, ddf.created_date, ddf.updated_date) AS diffDayTime,
TIMESTAMPDIFF(MINUTE, ddf.created_date, ddf.updated_date) AS diffMinuteTime,
ddf.battery_level AS batteryLevel,
ddf.catching_timer AS catchingTimer,
ddf.timer AS timer,
ddf.`week` AS `week`,
ddf.week_timer AS weekTimer,
tu.username,
tu.account operation
from t_vehicle tv
left join t_vehicle_device tvd on tvd.vehicle_id = tv.id
left join t_workorder tw on tw.id = tv.workorder_id
left join t_device td on td.sn = tvd.sn
left join t_device_location tdl on tdl.sn = tvd.sn
left join t_user tu on tu.id = tv.created_by
left join (select vehicle_id, sn, status from (SELECT * FROM t_device_freq order by created_date desc) temp GROUP BY temp.sn) ddf on ddf.vehicle_id = tv.id and ddf.sn =
td.sn
left join (select * from (SELECT * FROM t_device_freq order by created_date desc) temp GROUP BY temp.sn) ddf on ddf.vehicle_id = tv.id and ddf.sn = td.sn
left join t_user tu on tu.id = ddf.created_by
where tv.del_flag = 0
and tvd.bind_status = 1
and tvd.del_flag = 0
...
...
@@ -550,7 +626,8 @@
<iftest="deviceState != null">
<choose>
<whentest="deviceState == 0"><!-- 行驶中-->
and (td.source=1) and speed>0 and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or (timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 360)
and (td.source=1) and speed>0 and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or (timestampdiff(SECOND,tdl.last_bs_time,now()))
<![CDATA[<]]> 360)
</when>
<whentest="deviceState == 1"><!-- 静止-->
and (td.source=1) and (speed=0 or speed is null) and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or