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 =
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
and tvd.bind_status = 1
...
...
@@ -557,22 +564,28 @@
<iftest="deviceState != null">
<choose>
<whentest="deviceState == 0"><!-- 行驶中-->
and (td.source=1) 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 ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or
and (td.source=1) 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 ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or
case when td.source = 1 then '有线' when td.source = 0 then '无线' else '--' end as deviceTypeStr,
case when tv.type_id is null then tv.model_name else concat(tv.sub_brand_name,'/',tv.series_name,'/',tv.type_name) end as modelName,
case when tv.type_id is null then tv.model_name else
concat(tv.sub_brand_name,'/',tv.series_name,'/',tv.type_name) end as modelName,
tv.vehicle_type vehicleType,
tv.vehicle_usages vehicleUsages,
tv.created_date activateTime,
...
...
@@ -616,7 +630,8 @@
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_power tdp on tdp.sn = tvd.sn and tvd.id = tdp.vd_id
left join (select * from (select * from t_device_freq order by created_date desc) temp group by temp.sn) tdf on tdf.vehicle_id = tv.id and tdf.sn = td.sn
left join (select * from (select * from t_device_freq order by created_date desc) temp group by temp.sn) tdf on
tdf.vehicle_id = tv.id and tdf.sn = td.sn
left join t_user tu2 on tu2.id = tv.updated_by
where tv.del_flag = 0
and tvd.bind_status = 1
...
...
@@ -655,22 +670,28 @@
<iftest="deviceState != null">
<choose>
<whentest="deviceState == 0"><!-- 行驶中-->
and (td.source=1) 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 ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or
and (td.source=1) 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 ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or
select tvd.id, tw.partner_order_no as workOrderNo,
tu.username as shopName,
tv.owner_name as ownerName,
...
...
@@ -1114,7 +1136,8 @@
left join t_device td on td.sn = tvd.sn
left join t_device_location tdl on tdl.sn = td.sn
WHERE tvd.del_flag = 0 and tv.del_flag = 0 and tvd.bind_status = 1
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})
or (tdl.last_gps_time is null and tdl.last_bs_time is null)
or (tdl.last_gps_time is null and timestampdiff(SECOND, tdl.last_bs_time, now()) > #{offlineTime})
or (timestampdiff(SECOND, tdl.last_gps_time, now()) > #{offlineTime} and tdl.last_bs_time is null)
...
...
@@ -1133,7 +1156,8 @@
left join t_vehicle_device tvd on tvd.vehicle_id = tv.id
left join t_device td on td.sn = tvd.sn
left join t_workorder tw on tw.id = tv.workorder_id and tw.del_flag = 0
left join t_device_journey tdj on tvd.id = tdj.vd_id and tdj.begin_time <![CDATA[ >= ]]> #{journeyStartTime} and tdj.begin_time <![CDATA[ <= ]]> #{journeyEndTime}
left join t_device_journey tdj on tvd.id = tdj.vd_id and tdj.begin_time <![CDATA[ >= ]]> #{journeyStartTime} and
tdj.begin_time <![CDATA[ <= ]]> #{journeyEndTime}
where tv.del_flag = 0
and tvd.bind_status = 1
and tvd.del_flag = 0
...
...
@@ -1247,7 +1271,8 @@
and tvd.bind_status = 1
<choose>
<whentest="termType == 1">
and tv.id in (select vehicle_id from t_vehicle_device where del_flag = 0 and bind_status = 1 and sn = #{term})
and tv.id in (select vehicle_id from t_vehicle_device where del_flag = 0 and bind_status = 1 and sn =
#{term})
</when>
<whentest="termType == 2">
and tv.vin = #{term}
...
...
@@ -1292,7 +1317,8 @@
group_concat(td.device_type order by td.id) deviceTypes,
group_concat(td.source order by td.id) deviceSources,
tv.license_plate licensePlate,
case when tv.type_id is null then tv.model_name else concat(tv.sub_brand_name,'/',tv.series_name,'/',tv.type_name) end as modelName,
case when tv.type_id is null then tv.model_name else
concat(tv.sub_brand_name,'/',tv.series_name,'/',tv.type_name) end as modelName,
tv.created_date activateTime,
tw.created_date createdDate,
ifnull(tw.mechanic_name,tu.username) activator,
...
...
@@ -1320,7 +1346,8 @@
tv.owner_name like '%${term}%'
or tv.vin like '%${term}%'
or tw.partner_order_no like '%${term}%'
or tv.id in (select vehicle_id from t_vehicle_device where del_flag = 0 and bind_status = 1 and sn like '%${term}%')
or tv.id in (select vehicle_id from t_vehicle_device where del_flag = 0 and bind_status = 1 and sn like
'%${term}%')
)
</if>
group by tv.id
...
...
@@ -1338,7 +1365,8 @@
group_concat(td.device_type order by td.id) deviceTypes,
group_concat(td.source order by td.id) deviceSources,
tv.license_plate licensePlate,
case when tv.type_id is null then tv.model_name else concat(tv.sub_brand_name,'/',tv.series_name,'/',tv.type_name) end as modelName,
case when tv.type_id is null then tv.model_name else
concat(tv.sub_brand_name,'/',tv.series_name,'/',tv.type_name) end as modelName,
tv.created_date activateTime,
tv.remark,
tw.shop_name shopName,
...
...
@@ -1372,7 +1400,8 @@
tv.owner_name like '%${term}%'
or tv.vin like '%${term}%'
or tw.partner_order_no like '%${term}%'
or tv.id in (select vehicle_id from t_vehicle_device where del_flag = 0 and bind_status = 1 and sn like '%${term}%')
or tv.id in (select vehicle_id from t_vehicle_device where del_flag = 0 and bind_status = 1 and sn like