select da.device_apply_id, da.applier, u.nick_name as applier_nick_name, da.use_dept, d.dept_name, da.devices, da.project_id, p.project_number, p.project_name, da.apply_reason, da.apply_date, da.return_date, da.begin_date, da.end_date, da.days, da.dept_user_id, u1.nick_name as dept_nick_name, da.state, da.dept_comment, da.manager_user_id, u2.nick_name as manager_nick_name, da.manager_comment, da.dispatcher, u3.nick_name as dispatch_nick_name, da.dispatch_comment, da.estimate_cost, da.remark, da.dept_time, da.manager_time, da.dispatch_time from cmc_device_approval as da left join sys_user as u on u.user_id = da.applier left join sys_user as u1 on u1.user_id = da.dept_user_id left join sys_user as u2 on u2.user_id = da.manager_user_id left join sys_user as u3 on u3.user_id = da.dispatcher left join sys_dept as d on d.dept_id = da.use_dept left join cmc_project as p on da.project_id = p.project_id insert into cmc_device_approval device_apply_id, applier, use_dept, devices, project_id, apply_reason, apply_date, return_date, begin_date, end_date, days, dept_user_id, dept_comment, manager_user_id, manager_comment, dispatcher, dispatch_comment, estimate_cost, remark, state, dept_time, manager_time, dispatch_time, #{deviceApplyId}, #{applier}, #{useDept}, #{devices}, #{projectId}, #{applyReason}, #{applyDate}, #{returnDate}, #{beginDate}, #{endDate}, #{days}, #{deptUserId}, #{deptComment}, #{managerUserId}, #{managerComment}, #{dispatcher}, #{dispatchComment}, #{estimateCost}, #{remark}, #{state}, #{deptTime}, #{managerTime}, #{dispatchTime}, update cmc_device_approval applier = #{applier}, use_dept = #{useDept}, devices = #{devices}, project_id = #{projectId}, apply_reason = #{applyReason}, apply_date = #{applyDate}, return_date = #{returnDate}, begin_date = #{beginDate}, end_date = #{endDate}, days = #{days}, dept_user_id = #{deptUserId}, dept_comment = #{deptComment}, manager_user_id = #{managerUserId}, manager_comment = #{managerComment}, dispatcher = #{dispatcher}, dispatch_comment = #{dispatchComment}, estimate_cost = #{estimateCost}, remark = #{remark}, state = #{state}, dept_time = #{deptTime}, manager_time = #{managerTime}, dispatch_time = #{dispatchTime}, where device_apply_id = #{deviceApplyId} delete from cmc_device_approval where device_apply_id = #{deviceApplyId} delete from cmc_device_approval where device_apply_id in #{deviceApplyId}