select dh.device_handover_id, dh.device_id, dv.device_number, dv.code, dv.name, dv.brand, dv.series, dh.handover_dept_id, d.dept_name as handover_dept_name, u.nick_name as handover_nick_name, dh.handover_user_id, dh.handover_date,
dh.receive_dept_id, d1.dept_name as receive_dept_name, dh.receive_user_id, u1.nick_name as receive_nick_name, dh.description, dh.reason, dh.remark from cmc_device_handover as dh
left join sys_user as u on u.user_id = dh.handover_user_id
left join sys_user as u1 on u1.user_id = dh.receive_user_id
left join sys_dept as d on d.dept_id = dh.handover_dept_id
left join sys_dept as d1 on d1.dept_id = dh.receive_dept_id
left join cmc_device as dv on dv.device_id = dh.device_id
insert into cmc_device_handover
device_handover_id,device_id,handover_dept_id,handover_user_id,handover_date,receive_dept_id,receive_user_id,description,reason,remark,#{deviceHandoverId},#{deviceId},#{handoverDeptId},#{handoverUserId},#{handoverDate},#{receiveDeptId},#{receiveUserId},#{description},#{reason},#{remark},
update cmc_device_handover
device_id = #{deviceId},handover_dept_id = #{handoverDeptId},handover_user_id = #{handoverUserId},handover_date = #{handoverDate},receive_dept_id = #{receiveDeptId},receive_user_id = #{receiveUserId},description = #{description},reason = #{reason},remark = #{remark},
where device_handover_id = #{deviceHandoverId}
delete from cmc_device_handover where device_handover_id = #{deviceHandoverId}
delete from cmc_device_handover where device_handover_id in
#{deviceHandoverId}