SELECT a.id,
a.target_order_id,
a.target_station_id,
g.settlement_way,
CASE g.settlement_way
WHEN 'month' THEN '月结'
WHEN 'balance' THEN '余额抵扣'
WHEN 'cash' THEN '现付'
ELSE ''
END settlement_way_txt,
a.sn,
a.station_id,
a.certificate_sn,
a.lane,
a.project_id,
a.trans_company_id,
a.user_id,
a.audit_status,
a.qu_audit_picture,
a.shi_audit_picture,
a.shi_audit_memo,
a.shi_audit_time,
a.qu_audit_memo,
a.qu_audit_time,
a.qu_audit_user_id,
a.shi_audit_user_id,
n.nickname qu_audit_user_name,
o.nickname shi_audit_user_name,
a.order_category,
a.order_status,
a.checker_id,
a.check_status,
a.truck_id,
a.driver_id,
a.goods_id,
a.discount_money,
a.revise_money,
a.settle_money,
a.total_money,
a.refund_money,
a.payment_status,
a.customer_memo,
a.checker_memo,
a.cargo_photo,
a.check_photo,
a.creator_id,
a.modifier_id,
a.create_time,
a.modify_time,
a.pay_time,
a.refund_time,
a.expect_time,
a.estimated_quantity,
a.deleted,
a.cargo_place_id,
a.car_in_out_id,
a.trans_time,
a.site_photos,
b.province,
b.city,
b.area,
b.town,
b.province_name,
b.city_name,
b.area_name,
b.town_name,
b.address,
b.lng,
b.lat,
c.goods_category_id,
c.origin_goods_id,
c.goods_name,
c.unit_price,
c.unit,
c.money_strategy,
c.money_config_id,
c.picture,
c.tax_rate,
i.category_name,
d.rough_weight,
d.tare_weight,
d.settle_weight,
d.in_front_photo,
d.in_body_photo,
d.out_front_photo,
d.out_body_photo,
d.in_time,
d.out_time,
e.license_plate,
e.truck_license,
e.vn_code,
e.qualification,
e.carrying_capacity,
e.tare_weight history_tare_weight,
p.txt truck_category,
e.picture truck_picture,
f.user_id driver_user_id,
f.driver_name,
f.phone driver_phone,
f.driving_licence,
f.licence_start_time,
f.licence_end_time,
f.driving_licence_no,
g.uscc trans_uscc,
g.company_name trans_company_name,
g.business_license trans_business_license,
g.license_start_time trans_license_start_time,
g.license_end_time trans_license_end_time,
g.legal_representative trans_legal_representative,
g.province trans_province,
g.city trans_city,
g.area trans_area,
g.town trans_town,
g.province_name trans_province_name,
g.city_name trans_city_name,
g.area_name trans_area_name,
g.town_name trans_town_name,
g.address trans_address,
g.lng trans_lng,
g.lat trans_lat,
g.contacts trans_contacts,
g.phone trans_phone,
g.idcard trans_idcard,
g.idcard_start_time trans_idcard_start_time,
g.idcard_end_time trans_idcard_end_time,
g.idcard_front trans_idcard_front,
g.idcard_back trans_idcard_back,
h.nickname,
h.biz_obj,
h.phone user_phone,
j.company_name,
j.uscc,
k.nickname checker_name,
k.phone checker_phone,
l.project_name,
m.station_name,
m.station_type,
m.company_name station_company_name,
m.address station_address,
m.uscc station_uscc,
m.contacts station_contacts,
m.phone station_phone,
m.lng station_lng,
m.lat station_lat,
a.contacts,
a.check_time,
a.assignment_trans_time,
a.assignment_driver_time,
a.driver_confirm_time,
a.phone,
a.expect_time,
a.estimated_quantity,
e.truck_license_date,
e.qualification_date truck_qualification_date,
f.licence_start_time driver_licence_start_time,
f.licence_end_time driver_licence_end_time,
j.license_start_time,
j.license_end_time,
g.idcard trans_idcard,
g.idcard_start_time trans_idcard_start_time,
g.idcard_end_time trans_idcard_end_time,
c.money_way
FROM order_info a
LEFT JOIN order_cargo_place b ON b.id = a.cargo_place_id
LEFT JOIN order_goods c ON c.id = a.goods_id
LEFT JOIN goods_info gi ON gi.id = c.origin_goods_id
LEFT JOIN order_car_in_out d ON d.id = a.car_in_out_id
LEFT JOIN biz_truck e ON e.id = a.truck_id
LEFT JOIN biz_driver f ON f.id = a.driver_id
LEFT JOIN biz_company g ON g.id = a.trans_company_id
LEFT JOIN sys_user h ON h.id = a.user_id
LEFT JOIN goods_category i ON i.id = c.goods_category_id
LEFT JOIN biz_company j ON j.user_id = a.user_id
LEFT JOIN sys_user k ON k.id = a.checker_id
LEFT JOIN biz_project l ON l.id = a.project_id
LEFT JOIN biz_company m ON m.id = a.station_id AND m.station = 1
LEFT JOIN sys_user n ON n.id = a.qu_audit_user_id
LEFT JOIN sys_user o ON o.id = a.shi_audit_user_id
LEFT JOIN sys_dict_item p ON p.dict_key = 'vehicle_type' AND p.val = e.truck_category
UPDATE biz_driver
SET busy = #{busy}
WHERE id = #{driverId}
UPDATE biz_truck
SET busy = #{busy}
WHERE id = #{truckId}