select ca.car_apply_id, ca.applier, u.nick_name as applier_nick_name, ca.use_dept, d.dept_name, ca.cars, ca.drivers, ca.project_id, p.project_number, p.project_name,
ca.apply_reason, ca.passengers, ca.apply_date, ca.begin_date, ca.end_date, ca.days, ca.dept_user_id, u1.nick_name as dept_nick_name, ca.dept_comment, ca.manager_user_id,
u2.nick_name as manager_nick_name, ca.manager_comment, ca.car_usage, ca.union_user_id, u3.nick_name as union_nick_name, ca.union_comment, ca.gm_user_id, u4.nick_name as gm_nick_name,
ca.gm_comment, ca.dispatcher, u5.nick_name as dispatch_nick_name, ca.dispatch_comment, ca.estimate_cost, ca.dept_time, ca.manager_time, ca.union_time, ca.gm_time, ca.dispatch_time from cmc_car_approval as ca
left join sys_user as u on u.user_id = ca.applier
left join sys_user as u1 on u1.user_id = ca.dept_user_id
left join sys_user as u2 on u2.user_id = ca.manager_user_id
left join sys_user as u3 on u3.user_id = ca.union_user_id
left join sys_user as u4 on u4.user_id = ca.gm_user_id
left join sys_user as u5 on u5.user_id = ca.dispatcher
left join sys_dept as d on d.dept_id = ca.use_dept
left join cmc_project as p on ca.project_id = p.project_id
insert into cmc_car_approval
car_apply_id,applier,use_dept,cars,drivers,project_id,apply_reason,passengers,apply_date,begin_date,end_date,days,dept_user_id,dept_comment,manager_user_id,manager_comment,car_usage,union_user_id,union_comment,gm_user_id,gm_comment,dispatcher,dispatch_comment,estimate_cost,#{carApplyId},#{applier},#{useDept},#{cars},#{drivers},#{projectId},#{applyReason},#{passengers},#{applyDate},#{beginDate},#{endDate},#{days},#{deptUserId},#{deptComment},#{managerUserId},#{managerComment},#{carUsage},#{unionUserId},#{unionComment},#{gmUserId},#{gmComment},#{dispatcher},#{dispatchComment},#{estimateCost},
update cmc_car_approval
applier = #{applier},use_dept = #{useDept},cars = #{cars},drivers = #{drivers},project_id = #{projectId},apply_reason = #{applyReason},passengers = #{passengers},apply_date = #{applyDate},begin_date = #{beginDate},end_date = #{endDate},days = #{days},dept_user_id = #{deptUserId},dept_comment = #{deptComment},manager_user_id = #{managerUserId},manager_comment = #{managerComment},car_usage = #{carUsage},union_user_id = #{unionUserId},union_comment = #{unionComment},gm_user_id = #{gmUserId},gm_comment = #{gmComment},dispatcher = #{dispatcher},dispatch_comment = #{dispatchComment},estimate_cost = #{estimateCost},dept_time = #{deptTime},manager_time = #{managerTime},union_time = #{unionTime},gm_time = #{gmTime},dispatch_time = #{dispatchTime}
where car_apply_id = #{carApplyId}
delete from cmc_car_approval where car_apply_id = #{carApplyId}
delete from cmc_car_approval where car_apply_id in
#{carApplyId}