package com.ywt.mg.domain.entities;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

public interface OrderPaymentRepository extends JpaRepository<OrderPayment, Integer> {

    /**
     * 根据订单流水号得到最新的商户流水号对象
     *
     * @param orderNo
     * @return
     */
    @Query(value = "select * from order_payment where order_no = ? order by id desc limit 1;", nativeQuery = true)
    OrderPayment getOrderPaymentByOrderNo(String orderNo);

    @Query(value = "select * from order_payment where transaction_id = ? order by id desc limit 1;", nativeQuery = true)
    OrderPayment getOrderPaymentByTransactionId(String transactionId);
}
