package com.ruoyi.system.omgpay.mapper; import com.ruoyi.system.omgpay.domain.OmgPaymentAttempt; import com.ruoyi.system.omgpay.domain.OmgPaymentOrderSnapshot; import org.apache.ibatis.annotations.Param; /** * Persistence boundary for locking order facts and appending OMG payment attempts. */ public interface OmgPaymentAttemptMapper { OmgPaymentOrderSnapshot selectOrderForUpdate(@Param("ddId") String ddId); /** Current read used both before creation and after an active-order unique-key conflict. */ OmgPaymentAttempt selectActiveCreatedByDdIdForUpdate(@Param("ddId") String ddId); /** Current read used after an insert conflict to classify a committed trade-number collision. */ OmgPaymentAttempt selectByMerchantTradeNoForUpdate(@Param("merchantTradeNo") String merchantTradeNo); /** Preliminary read used to discover the order before locks are acquired in order-first sequence. */ OmgPaymentAttempt selectByMerchantTradeNo(@Param("merchantTradeNo") String merchantTradeNo); int insertCreated(OmgPaymentAttempt row); int markPaid(OmgPaymentAttempt row); int markFailed(OmgPaymentAttempt row); int supersedeOtherCreated(@Param("ddId") String ddId, @Param("paidAttemptId") Long paidAttemptId, @Param("updateTime") java.util.Date updateTime); int markOrderPaid(@Param("ddId") String ddId); int countOtherPaidAttempts(@Param("ddId") String ddId, @Param("attemptId") Long attemptId); }