Commit a81b370a by 杨林龙

优化查询字段

1 parent 6588d6f1
...@@ -308,10 +308,12 @@ ...@@ -308,10 +308,12 @@
from t_vehicle tv from t_vehicle tv
left join t_vehicle_device tvd on tvd.vehicle_id = tv.id 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_device td on td.sn = tvd.sn
left join (select * from (SELECT * FROM t_device_freq order by created_date desc) temp GROUP BY temp.sn) ddf on left join (select * from (SELECT * FROM t_device_freq order by created_date desc) temp GROUP BY temp.sn) ddf
ddf.vehicle_id = tv.id and ddf.sn = td.sn 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 td.del_flag = 0
<if test="keywords != null and keywords !=''"> <if test="keywords != null and keywords !=''">
and( and(
tv.owner_name like '%${keywords}%' tv.owner_name like '%${keywords}%'
...@@ -353,10 +355,12 @@ ...@@ -353,10 +355,12 @@
from t_vehicle tv from t_vehicle tv
left join t_vehicle_device tvd on tvd.vehicle_id = tv.id 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_device td on td.sn = tvd.sn
left join (select * from (SELECT * FROM t_device_freq order by created_date desc) temp GROUP BY temp.sn) ddf on left join (select * from (SELECT * FROM t_device_freq order by created_date desc) temp GROUP BY temp.sn) ddf
ddf.vehicle_id = tv.id and ddf.sn = td.sn 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 td.del_flag = 0
<if test="keywords != null and keywords !=''"> <if test="keywords != null and keywords !=''">
and( and(
tv.owner_name like '%${keywords}%' tv.owner_name like '%${keywords}%'
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!