select id, customer_id, currency, balance, frozen_balance, total_credit, credit_effective_date, credit_expire_date, extra_credit, extra_effective_date, extra_expire_date, used_credit, tax, version, create_by, create_time, update_by, update_time, remark, del_flag from customer_account insert into customer_account customer_id, currency, balance, frozen_balance, total_credit, extra_credit, used_credit, tax, version, create_by, remark, del_flag, #{customerId}, #{currency}, #{balance}, #{frozenBalance}, #{totalCredit}, #{extraCredit}, #{usedCredit}, #{tax}, #{version}, #{createBy}, #{remark}, '0', update customer_account set balance = #{balance}, frozen_balance = #{frozenBalance}, used_credit = #{usedCredit}, version = version + 1, update_by = #{updateBy}, update_time = now() where id = #{id} and version = #{version} and del_flag = '0' update customer_account set total_credit = #{totalCredit}, credit_effective_date = #{creditEffectiveDate}, credit_expire_date = #{creditExpireDate}, extra_credit = #{extraCredit}, extra_effective_date = #{extraEffectiveDate}, extra_expire_date = #{extraExpireDate}, version = version + 1, update_by = #{updateBy}, update_time = now() where id = #{id} and version = #{version} and del_flag = '0' select id, flow_no, customer_id, account_id, credit_type, change_type, biz_type, biz_id, biz_no, direction, before_amount, change_amount, after_amount, used_credit, effective_date, expire_date, reason, adjust_mode, operator_id, role_id, create_by, create_time, update_by, update_time, remark, del_flag from customer_credit_flow insert into customer_credit_flow flow_no, customer_id, account_id, credit_type, change_type, biz_type, biz_id, biz_no, direction, before_amount, change_amount, after_amount, used_credit, effective_date, expire_date, reason, adjust_mode, operator_id, role_id, create_by, remark, del_flag, #{flowNo}, #{customerId}, #{accountId}, #{creditType}, #{changeType}, #{bizType}, #{bizId}, #{bizNo}, #{direction}, #{beforeAmount}, #{changeAmount}, #{afterAmount}, #{usedCredit}, #{effectiveDate}, #{expireDate}, #{reason}, #{adjustMode}, #{operatorId}, #{roleId}, #{createBy}, #{remark}, #{delFlag}, select r.id, r.receipt_no, r.customer_id, r.account_id, r.receipt_type, r.amount, r.allocated_amount, r.unallocated_amount, r.currency, r.exchange_rate, r.rate_source, r.rate_source_desc, r.base_amount, r.pay_method, r.bank_transaction_no, r.received_at, r.status, r.confirmed_at, r.confirmed_by, r.invoice_status, r.version, r.create_by, r.create_time, r.update_by, r.update_time, r.remark, r.del_flag, (select count(1) from bms_customer_attachment a where a.biz_id = r.id and a.attachment_type = '3' and a.del_flag = '0') as attachment_count from customer_receipt r insert into customer_receipt receipt_no, customer_id, account_id, receipt_type, amount, allocated_amount, unallocated_amount, currency, exchange_rate, rate_source, rate_source_desc, base_amount, pay_method, bank_transaction_no, received_at, status, confirmed_at, confirmed_by, invoice_status, version, create_by, remark, del_flag, #{receiptNo}, #{customerId}, #{accountId}, #{receiptType}, #{amount}, #{allocatedAmount}, #{unallocatedAmount}, #{currency}, #{exchangeRate}, #{rateSource}, #{rateSourceDesc}, #{baseAmount}, #{payMethod}, #{bankTransactionNo}, #{receivedAt}, #{status}, #{confirmedAt}, #{confirmedBy}, #{invoiceStatus}, #{version}, #{createBy}, #{remark}, '0', update customer_receipt set status = 'CONFIRMED', confirmed_at = #{confirmedAt}, confirmed_by = #{confirmedBy}, version = version + 1, update_by = #{updateBy}, update_time = now() where id = #{id} and status = 'PENDING' and version = #{version} and del_flag = '0' update customer_receipt set status = 'CANCELLED', update_by = #{updateBy}, update_time = now() where id = #{id} and status = 'PENDING' and del_flag = '0' select id, flow_no, customer_id, account_id, currency, exchange_rate, base_amount, biz_type, biz_id, biz_no, direction, amount, before_balance, after_balance, before_frozen_balance, after_frozen_balance, operator_id, create_by, create_time, update_by, update_time, remark, del_flag from customer_balance_flow insert into customer_balance_flow flow_no, customer_id, account_id, currency, exchange_rate, base_amount, biz_type, biz_id, biz_no, direction, amount, before_balance, after_balance, before_frozen_balance, after_frozen_balance, operator_id, create_by, remark, del_flag, #{flowNo}, #{customerId}, #{accountId}, #{currency}, #{exchangeRate}, #{baseAmount}, #{bizType}, #{bizId}, #{bizNo}, #{direction}, #{amount}, #{beforeBalance}, #{afterBalance}, #{beforeFrozenBalance}, #{afterFrozenBalance}, #{operatorId}, #{createBy}, #{remark}, '0',