Commit fb95e823 by 杨林龙

优化车辆的显示

1 parent 1c0c7ebf
...@@ -169,8 +169,7 @@ ...@@ -169,8 +169,7 @@
tvd.created_date installedTime tvd.created_date installedTime
from t_vehicle tv from t_vehicle tv
inner join t_trial_drive_vehicle ttdv on ttdv.vehicle_id = tv.id inner join t_trial_drive_vehicle ttdv on ttdv.vehicle_id = tv.id
left join t_vehicle_device tvd on tv.id = tvd.vehicle_id and tvd.bind_status = 1 and tvd.del_flag = 0 and left join t_vehicle_device tvd on tv.id = tvd.vehicle_id and tvd.bind_status = 1 and tvd.del_flag = 0 and tvd.trial_type = 1
tvd.trial_type = 1
left join t_user tu on tv.created_by = tu.id and tu.del_flag = 0 left join t_user tu on tv.created_by = tu.id and tu.del_flag = 0
left join t_trial_drive_shop ttds on tu.id = ttds.created_by and ttds.del_flag = 0 left join t_trial_drive_shop ttds on tu.id = ttds.created_by and ttds.del_flag = 0
where tv.del_flag = 0 where tv.del_flag = 0
...@@ -193,8 +192,7 @@ ...@@ -193,8 +192,7 @@
tvd.sn sns tvd.sn sns
from t_vehicle tv from t_vehicle tv
inner join t_trial_drive_vehicle ttdv on ttdv.vehicle_id = tv.id inner join t_trial_drive_vehicle ttdv on ttdv.vehicle_id = tv.id
left join t_vehicle_device tvd on tv.id = tvd.vehicle_id and tvd.bind_status = 1 and tvd.del_flag = 0 and left join t_vehicle_device tvd on tv.id = tvd.vehicle_id and tvd.bind_status = 1 and tvd.del_flag = 0 and tvd.trial_type = 1
tvd.trial_type = 1
left join t_user tu on tv.created_by = tu.id and tu.del_flag = 0 left join t_user tu on tv.created_by = tu.id and tu.del_flag = 0
left join t_trial_drive_shop ttds on tu.id = ttds.created_by and ttds.del_flag = 0 left join t_trial_drive_shop ttds on tu.id = ttds.created_by and ttds.del_flag = 0
where tv.del_flag = 0 where tv.del_flag = 0
...@@ -298,7 +296,8 @@ ...@@ -298,7 +296,8 @@
tvd.id vdId , tvd.id vdId ,
tv.workorder_id , tv.workorder_id ,
tv.owner_name , tv.owner_name ,
tv.vin ,td.sn , tv.vin ,
td.sn ,
td.source , td.source ,
tv.model_name , tv.model_name ,
tv.vehicle_type , tv.vehicle_type ,
...@@ -306,14 +305,11 @@ ...@@ -306,14 +305,11 @@
td.activate_time , td.activate_time ,
ddf.`status` AS freqStatus ddf.`status` AS freqStatus
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 and tvd.bind_status = 1 and tvd.del_flag = 0
left join t_device td on td.sn = tvd.sn left join t_device td on td.sn = tvd.sn and td.del_flag = 0
left join (select * from (SELECT * FROM t_device_freq order by created_date desc) temp GROUP BY temp.sn) ddf 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 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.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}%'
...@@ -354,14 +350,11 @@ ...@@ -354,14 +350,11 @@
td.activate_time , td.activate_time ,
ddf.`status` AS freqStatus ddf.`status` AS freqStatus
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 and tvd.bind_status = 1 and tvd.del_flag = 0
left join t_device td on td.sn = tvd.sn left join t_device td on td.sn = tvd.sn and td.del_flag = 0
left join (select * from (SELECT * FROM t_device_freq order by created_date desc) temp GROUP BY temp.sn) ddf 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 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.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}%'
...@@ -397,13 +390,12 @@ ...@@ -397,13 +390,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 t_user tu on tu.id = tv.created_by left join t_user tu on tu.id = tv.created_by and tu.del_flag = 0
where tv.del_flag = 0 where tv.del_flag = 0
and tvd.bind_status = 1 and tvd.bind_status = 1
and tvd.trial_type = 0 and tvd.trial_type = 0
and tvd.del_flag = 0 and tvd.del_flag = 0
and td.del_flag = 0 and td.del_flag = 0
and tu.del_flag = 0
<if test="sn != null and sn !=''"> <if test="sn != null and sn !=''">
and td.sn like concat('%',#{sn},'%') and td.sn like concat('%',#{sn},'%')
</if> </if>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!