select ca.car_apply_id, ca.applier, u.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.begin_halfday, ca.end_date, ca.end_halfday, ca.days, ca.dept_user_id, ca.dept_comment, ca.manager_user_id, ca.manager_comment, ca.union_user_id, ca.union_comment, ca.dispatcher, ca.dispatch_comment, ca.estimate_cost from cmc_car_approval as ca
left join sys_user as u on u.user_id = ca.applier
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,
begin_halfday,
end_date,
end_halfday,
days,
dept_user_id,
dept_comment,
manager_user_id,
manager_comment,
union_user_id,
union_comment,
dispatcher,
dispatch_comment,
estimate_cost,
#{carApplyId},
#{applier},
#{useDept},
#{cars},
#{drivers},
#{projectId},
#{applyReason},
#{passengers},
#{applyDate},
#{beginDate},
#{beginHalfday},
#{endDate},
#{endHalfday},
#{days},
#{deptUserId},
#{deptComment},
#{managerUserId},
#{managerComment},
#{unionUserId},
#{unionComment},
#{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},
begin_halfday = #{beginHalfday},
end_date = #{endDate},
end_halfday = #{endHalfday},
days = #{days},
dept_user_id = #{deptUserId},
dept_comment = #{deptComment},
manager_user_id = #{managerUserId},
manager_comment = #{managerComment},
union_user_id = #{unionUserId},
union_comment = #{unionComment},
dispatcher = #{dispatcher},
dispatch_comment = #{dispatchComment},
estimate_cost = #{estimateCost},
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}