select export_id, ar_bill_id, file_name, file_type, template_id, template_code, template_version, template_storage_type, template_storage_key, template_hash, storage_key, file_size, file_hash, row_count, export_status, export_by, export_time, remark from ar_bill_export insert into ar_bill_export ( ar_bill_id, file_name, file_type, template_id, template_code, template_version, template_storage_type, template_storage_key, template_hash, storage_key, file_size, file_hash, row_count, export_status, export_by, export_time, remark ) values ( #{arBillId}, #{fileName}, #{fileType}, #{templateId}, #{templateCode}, #{templateVersion}, #{templateStorageType}, #{templateStorageKey}, #{templateHash}, #{storageKey}, #{fileSize}, #{fileHash}, #{rowCount}, #{exportStatus}, #{exportBy}, sysdate(), #{remark} ) update ar_bill_export set storage_key = #{storageKey}, file_size = #{fileSize}, file_hash = #{fileHash}, export_status = 'SUCCESS', remark = null where export_id = #{exportId} and export_status = 'PROCESSING' update ar_bill_export set export_status = 'FAILED', remark = #{remark} where export_id = #{exportId} and export_status = 'PROCESSING' update ar_bill_export set export_status = 'FAILED', remark = #{remark} where export_status = 'PROCESSING' and export_time < #{expiredBefore}