insert into cash_record_collection(order_type,jwcode,name,market,activity, order_code,goods_name,good_num,num_unit,permanent_gold,free_gold, payment_currency,payment_amount,received_market, pay_type,pay_time,status,submitter_id,submitter_market, voucher,remark) values(#{orderType},#{jwcode},#{name},#{market},#{activity}, #{orderCode},#{goodsName},#{goodNum},#{numUnit},#{permanentGold},#{freeGold},#{paymentCurrency}, #{paymentAmount},#{receivedMarket},#{payType},#{payTime}, #{status},#{submitterId},#{submitterMarket},#{voucher},#{remark}) update cash_record_collection set status=#{status} where order_code=#{orderCode} UPDATE cash_record_collection jwcode = #{cashRecordCollection.jwcode}, name = #{cashRecordCollection.name}, market = #{cashRecordCollection.market}, activity = #{cashRecordCollection.activity}, goods_name = #{cashRecordCollection.goodsName}, good_num = #{cashRecordCollection.goodNum}, num_unit = #{cashRecordCollection.numUnit}, permanent_gold = #{cashRecordCollection.permanentGold}, free_gold = #{cashRecordCollection.freeGold}, payment_currency = #{cashRecordCollection.paymentCurrency}, payment_amount = #{cashRecordCollection.paymentAmount}, received_market = #{cashRecordCollection.receivedMarket}, pay_type = #{cashRecordCollection.payType}, pay_time = #{cashRecordCollection.payTime}, voucher = #{cashRecordCollection.voucher}, remark = #{cashRecordCollection.remark}, status = 0, WHERE order_code = #{cashRecordCollection.orderCode} AND status = 5 UPDATE cash_record_collection handling_charge = #{cashRecordCollection.handlingCharge}, received_currency = #{cashRecordCollection.receivedCurrency}, received_amount = #{cashRecordCollection.receivedAmount}, received_time = #{cashRecordCollection.receivedTime}, payment_currency = #{cashRecordCollection.paymentCurrency}, payment_amount = #{cashRecordCollection.paymentAmount}, status = CASE WHEN handling_charge IS NOT NULL AND received_currency IS NOT NULL AND received_currency != '' AND received_amount IS NOT NULL AND received_time IS NOT NULL AND payment_currency IS NOT NULL AND payment_currency != '' AND payment_amount IS NOT NULL THEN 4 ELSE status END WHERE order_code = #{cashRecordCollection.orderCode} AND status IN (1, 3) update g_order set is_synced = 1 where id = #{orderId} update cash_record_collection SET received_time=#{time}, payment_currency=#{currency}, received_currency=#{currency}, payment_amount=#{order_amount}, received_amount=#{net_amount}, handling_charge=#{charge}, order_no_status=0 where order_no=#{merchant_reference}