select b.id, b.car_no, b.dept_id, b.create_by, b.create_time, b.update_by, b.update_time, b.remark,d.dept_name as team,b.line,b.type from base_car b
LEFT JOIN sys_dept d ON d.dept_id = b.dept_id
where b.id is not null
<iftest="carNo != null and carNo != ''"> and car_no like concat('%', #{carNo}, '%')</if>
select b.id, b.car_no, b.dept_id, b.create_by, b.create_time, b.update_by, b.update_time, b.remark,d.dept_name as team,b.line,b.type, T.input_mileage from base_car b
LEFT JOIN sys_dept d ON d.dept_id = b.dept_id
LEFT JOIN (SELECT create_time,input_mileage,vehicle_id FROM biz_maintenance_order WHERE type_code = 1 AND status ='COMPLETED'
ORDER BY create_time DESC LIMIT 1) T ON T.vehicle_id = b.id
where b.id is not null
<iftest="carNo != null and carNo != ''"> and b.car_no like concat('%', #{carNo}, '%')</if>
<iftest="team != null and team != ''"> and d.dept_name = #{team}</if>
<iftest="line != null and line != ''"> and b.line like concat('%', #{line}, '%')</if>
<iftest="type != null and type != ''"> and b.type like concat('%', #{type}, '%')</if>