select a.*,b.approval_number from reconciliation a LEFT JOIN approval_document b ON a.instance_id = b.approval_order_number
a.del_flag =1
and a.invoice_apply_status = #{invoiceApplyStatus}
and a.synchronous_status = #{synchronousStatus}
and a.sk_synchronous_status = #{skSynchronousStatus}
and a.verification_money = #{verificationMoney}
and a.is_invoice = #{isInvoice}
and a.settlement_count = #{settlementCount}
and a.user_id = #{userId}
and a.apply_number like concat('%', #{applyNumber}, '%')
and a.shipper_name like concat('%', #{shipperName}, '%')
and a.inner_number like concat('%', #{innerNumber}, '%')
and a.inner_number like concat('%', #{partyName}, '%')
and a.bill_remark like concat('%', #{billRemark}, '%')
and a.settlement_remark like concat('%', #{settlementRemark}, '%')
and a.audit_number like concat('%', #{auditNumber}, '%')
and a.waybill_source = #{waybillSource}
and a.waybill_source_name like concat('%', #{waybillSourceName}, '%')
and a.reconciliation_start = #{reconciliationStart}
and a.reconciliation_end = #{reconciliationEnd}
and a.bill_name like concat('%', #{billName}, '%')
and a.collection_amount = #{collectionAmount}
and a.change_amount = #{changeAmount}
and a.other_amount = #{otherAmount}
and a.receivable = #{receivable}
and a.actual_receivable = #{actualReceivable}
and a.uncollected_receivable = #{uncollectedReceivable}
and a.collection_state = #{collectionState}
and a.audit_state = #{auditState}
and a.audit_type = #{auditType}
and a.create_by_name like concat('%', #{createByName}, '%')
and a.update_by_name like concat('%', #{updateByName}, '%')
and a.organization_id = #{organizationId}
and a.top_organization_id = #{topOrganizationId}
AND (date_format(a.collection_time,'%Y-%m-%d') >= date_format(#{collectionTimeStart},'%Y-%m-%d')
and date_format(a.collection_time,'%Y-%m-%d') date_format(#{collectionTimeEnd},'%Y-%m-%d'))
AND (date_format(a.create_time,'%Y-%m-%d') >= date_format(#{createTimeStart},'%Y-%m-%d')
and date_format(a.create_time,'%Y-%m-%d') date_format(#{createTimeEnd},'%Y-%m-%d'))
AND (date_format(a.auth_time,'%Y-%m-%d') >= date_format(#{authTimeStart},'%Y-%m-%d')
and date_format(a.auth_time,'%Y-%m-%d') date_format(#{authTimeEnd},'%Y-%m-%d'))
and a.inner_number in
#{innerNumber}
insert into reconciliation_business_document(business_document_id,reconciliation_id) values
(#{item.businessDocumentId},#{item.reconciliationId})
update reconciliation_business_document set del_flag = 2 where reconciliation_id = #{reconciliationId}
update reconciliation set del_flag = 2 where inner_number = #{innerNumber}
update reconciliation_order_detail set del_flag = 2 where reconciliation_id = #{reconciliationId}