insert into cash_record(order_type,jwcode,name,market,activity, order_code,goods_name,good_num,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},#{permanentGold},#{freeGold},#{paymentCurrency}, #{paymentAmount},#{receivedMarket},#{payType},#{payTime}, #{status},#{submitterId},#{submitterMarket},#{voucher},#{remark}) update cash_record set status=#{status} where order_code=#{orderCode} UPDATE cash_record jwcode = #{cashRecord.jwcode}, name = #{cashRecord.name}, market = #{cashRecord.market}, activity = #{cashRecord.activity}, goods_name = #{cashRecord.goodsName}, good_num = #{cashRecord.goodNum}, payment_currency = #{cashRecord.paymentCurrency}, payment_amount = #{cashRecord.paymentAmount}, received_market = #{cashRecord.receivedMarket}, pay_type = #{cashRecord.payType}, pay_time = #{cashRecord.payTime}, voucher = #{cashRecord.voucher}, remark = #{cashRecord.remark}, status = 0, WHERE order_code = #{cashRecord.orderCode} AND status = 5 UPDATE cash_record handling_charge = #{cashRecord.handlingCharge}, received_currency = #{cashRecord.receivedCurrency}, received_amount = #{cashRecord.receivedAmount}, received_time = #{cashRecord.receivedTime}, payment_currency = #{cashRecord.paymentCurrency}, payment_amount = #{cashRecord.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 = #{cashRecord.orderCode} AND status IN (1, 3) update g_order set is_synced = 1 where id = #{orderId}