IF(ddf.user_type = 1, tu.username, tcula.username) AS operation
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_workorder tw on tw.id = tv.workorder_id
left join t_workorder tw on tw.id = tv.workorder_id
...
@@ -577,6 +577,8 @@
...
@@ -577,6 +577,8 @@
left join t_device_power tdp on tdp.sn = tvd.sn and tvd.id = tdp.vd_id
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) 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
left join t_user tu on tu.id = ddf.created_by
left join t_cust_user_auth_rel tcuar on tcuar.user_id = ddf.created_by and tcuar.auth_type = 'local'
left join t_cust_user_local_account tcula on tcula.auth_id = tcuar.auth_id