| 123456789101112131415 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.ruoyi.system.mapper.flash.FlashDeliveryLinePaymentMapper">
- <sql id="columns">id,order_id AS orderId,rider_id AS riderId,credential_id AS credentialId,line_order_id AS lineOrderId,transaction_id AS transactionId,amount AS amount,captured_amount AS capturedAmount,currency AS currency,payment_url AS paymentUrl,status AS status,active_order_id AS activeOrderId,version AS version,lease_until AS leaseUntil,next_reconcile_at AS nextReconcileAt,reconcile_deadline AS reconcileDeadline,paid_at AS paidAt,create_time AS createTime,update_time AS updateTime</sql>
- <select id="selectForUpdate" resultType="com.ruoyi.system.domain.flash.FlashDeliveryLinePayment">SELECT <include refid="columns"/> FROM flash_delivery_line_payment WHERE id=#{id} FOR UPDATE</select>
- <select id="selectLatest" resultType="com.ruoyi.system.domain.flash.FlashDeliveryLinePayment">SELECT <include refid="columns"/> FROM flash_delivery_line_payment WHERE order_id=#{orderId} ORDER BY id DESC LIMIT 1</select>
- <!-- 订单锁后必须当前读,不能使用取得订单锁前建立的旧事务快照。 -->
- <select id="selectLatestForUpdate" resultType="com.ruoyi.system.domain.flash.FlashDeliveryLinePayment">SELECT <include refid="columns"/> FROM flash_delivery_line_payment WHERE order_id=#{orderId} ORDER BY id DESC LIMIT 1 FOR UPDATE</select>
- <select id="selectByLineOrderId" resultType="com.ruoyi.system.domain.flash.FlashDeliveryLinePayment">SELECT <include refid="columns"/> FROM flash_delivery_line_payment WHERE line_order_id=#{lineOrderId}</select>
- <!-- 版本门禁防止旧网关响应或过期任务覆盖新事实。 -->
- <update id="updateVersioned">UPDATE flash_delivery_line_payment SET transaction_id=#{row.transactionId},captured_amount=#{row.capturedAmount},payment_url=#{row.paymentUrl},status=#{row.status},active_order_id=#{row.activeOrderId},lease_until=#{row.leaseUntil},next_reconcile_at=#{row.nextReconcileAt},reconcile_deadline=#{row.reconcileDeadline},paid_at=#{row.paidAt},update_time=#{row.updateTime},version=version+1 WHERE id=#{row.id} AND version=#{expectedVersion}</update>
- <select id="selectDue" resultType="com.ruoyi.system.domain.flash.FlashDeliveryLinePayment">SELECT <include refid="columns"/> FROM flash_delivery_line_payment
- WHERE status IN ('CREATED','REQUESTING','WAITING_AUTH','CONFIRMING','REQUEST_UNKNOWN','CONFIRM_UNKNOWN')
- AND (next_reconcile_at IS NULL OR next_reconcile_at <= #{now}) AND (lease_until IS NULL OR lease_until <= #{now}) ORDER BY next_reconcile_at, id LIMIT #{limit}</select>
- </mapper>
|