| 1 |
package com.paymentlink.repository; |
| 2 |
|
| 3 |
import com.paymentlink.model.entity.PaymentLink; |
| 4 |
import org.springframework.data.jpa.repository.JpaRepository; |
| 5 |
import org.springframework.data.jpa.repository.Query; |
| 6 |
import org.springframework.data.repository.query.Param; |
| 7 |
import org.springframework.stereotype.Repository; |
| 8 |
|
| 9 |
import java.util.List; |
| 10 |
import java.util.Optional; |
| 11 |
|
| 12 |
@Repository |
| 13 |
public interface PaymentLinkRepository extends JpaRepository<PaymentLink, Long> { |
| 14 |
|
| 15 |
Optional<PaymentLink> findByLinkId(String linkId); |
| 16 |
|
| 17 |
@Query("SELECT pl FROM PaymentLink pl LEFT JOIN FETCH pl.items WHERE pl.linkId = :linkId") |
| 18 |
Optional<PaymentLink> findByLinkIdWithItems(@Param("linkId") String linkId); |
| 19 |
|
| 20 |
List<PaymentLink> findByStatus(String status); |
| 21 |
|
| 22 |
Optional<PaymentLink> findByStripePaymentIntentId(String stripePaymentIntentId); |
| 23 |
} |
| 24 |
|
| 25 |
|