left join t_vehicle_device tvd on tv.id = tvd.vehicle_id
left join t_vehicle_device tvd on tv.id = tvd.vehicle_id
left join t_workorder tw on tw.id = tv.workorder_id
left join t_device td on tvd.sn = td.sn
left join t_device td on tvd.sn = td.sn
where tv.del_flag = 0 and tvd.del_flag = 0
where tv.del_flag = 0 and tvd.del_flag = 0
and tvd.bind_status = 1
and tvd.bind_status = 1
<iftest="checkedUserIdsStr != null and checkedUserIdsStr !=''">
and find_in_set(tv.created_by,#{checkedUserIdsStr})
</if>
<iftest="term != null and term != ''">
<iftest="term != null and term != ''">
<choose>
<choose>
<whentest="termType == 1">
<whentest="termType == 1">
...
@@ -134,8 +138,17 @@
...
@@ -134,8 +138,17 @@
<whentest="termType == 2">
<whentest="termType == 2">
and tv.vin like concat('%',#{term},'%')
and tv.vin like concat('%',#{term},'%')
</when>
</when>
<whentest="termType == 3">
and tv.owner_name like concat('%',#{term},'%')
</when>
<whentest="termType == 4">
and tw.partner_order_no like concat('%',#{term},'%')
</when>
</choose>
</choose>
</if>
</if>
<iftest="startTime != null and startTime != '' and endTime != null and endTime != ''">
and DATE_FORMAT(tvd.created_date,'%Y-%m-%d') between #{startTime} and #{endTime}
</if>
<iftest="shopId != null">
<iftest="shopId != null">
and tv.created_by = #{shopId}
and tv.created_by = #{shopId}
</if>
</if>
...
@@ -419,7 +432,8 @@
...
@@ -419,7 +432,8 @@
left join t_workorder tw on tw.id = tv.workorder_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 td on td.sn = tvd.sn
left join t_device_location tdl on tdl.sn = tvd.sn
left join t_device_location tdl on tdl.sn = tvd.sn
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 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
where tv.del_flag = 0
where tv.del_flag = 0
and tvd.bind_status = 1
and tvd.bind_status = 1
and tvd.del_flag = 0
and tvd.del_flag = 0
...
@@ -453,10 +467,12 @@
...
@@ -453,10 +467,12 @@
<iftest="deviceState != null">
<iftest="deviceState != null">
<choose>
<choose>
<whentest="deviceState == 0"><!-- 行驶中-->
<whentest="deviceState == 0"><!-- 行驶中-->
and (td.source=1) and speed>0 and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 600 or (timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 600)
and (td.source=1) and speed>0 and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 600 or (timestampdiff(SECOND,tdl.last_bs_time,now()))
<![CDATA[<]]> 600)
</when>
</when>
<whentest="deviceState == 1"><!-- 静止-->
<whentest="deviceState == 1"><!-- 静止-->
and (td.source=1) and (speed=0 or speed is null) and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 600 or (timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 600)
and (td.source=1) and (speed=0 or speed is null) and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 600 or
and (timestampdiff(SECOND,tdl.last_gps_time,now())) > #{offlineTime} and (timestampdiff(SECOND,tdl.last_bs_time,now())) > #{offlineTime}
and (timestampdiff(SECOND,tdl.last_gps_time,now())) > #{offlineTime} and (timestampdiff(SECOND,tdl.last_bs_time,now())) > #{offlineTime}
...
@@ -491,7 +507,8 @@
...
@@ -491,7 +507,8 @@
left join t_workorder tw on tw.id = tv.workorder_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 td on td.sn = tvd.sn
left join t_device_location tdl on tdl.sn = tvd.sn
left join t_device_location tdl on tdl.sn = tvd.sn
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 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
where tv.del_flag = 0
where tv.del_flag = 0
and tvd.bind_status = 1
and tvd.bind_status = 1
and tvd.del_flag = 0
and tvd.del_flag = 0
...
@@ -525,10 +542,12 @@
...
@@ -525,10 +542,12 @@
<iftest="deviceState != null">
<iftest="deviceState != null">
<choose>
<choose>
<whentest="deviceState == 0"><!-- 行驶中-->
<whentest="deviceState == 0"><!-- 行驶中-->
and (td.source=1) and speed>0 and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 600 or (timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 600)
and (td.source=1) and speed>0 and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 600 or (timestampdiff(SECOND,tdl.last_bs_time,now()))
<![CDATA[<]]> 600)
</when>
</when>
<whentest="deviceState == 1"><!-- 静止-->
<whentest="deviceState == 1"><!-- 静止-->
and (td.source=1) and (speed=0 or speed is null) and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 600 or (timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 600)
and (td.source=1) and (speed=0 or speed is null) and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 600 or