File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
src/main/java/com/threestar/trainus/domain/payment/repository Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -35,10 +35,23 @@ List<Long> findPaymentIdsByUserAndStatus(
3535 @ Param ("limit" ) int limit
3636 );
3737
38+ @ Query (value = """
39+ SELECT p.id FROM payments p
40+ WHERE p.user_id = :userId
41+ AND p.status = :status
42+ ORDER BY p.cancelled_at DESC
43+ LIMIT :limit OFFSET :offset
44+ """ , nativeQuery = true )
45+ List <Long > findCancelledPaymentIdsByUserAndStatus (
46+ @ Param ("userId" ) Long userId ,
47+ @ Param ("status" ) String status ,
48+ @ Param ("offset" ) int offset ,
49+ @ Param ("limit" ) int limit
50+ );
51+
3852 @ Query ("""
3953 SELECT p FROM Payment p
4054 LEFT JOIN FETCH p.lesson
41- LEFT JOIN FETCH p.userCoupon
4255 WHERE p.id IN :ids
4356 """ )
4457 List <Payment > findAllWithAssociationsByIds (@ Param ("ids" ) List <Long > ids );
Original file line number Diff line number Diff line change 11package com .threestar .trainus .domain .payment .repository ;
22
3+ import java .util .List ;
34import java .util .Optional ;
45
56import org .springframework .data .jpa .repository .JpaRepository ;
7+ import org .springframework .data .jpa .repository .Query ;
8+ import org .springframework .data .repository .query .Param ;
69
710import com .threestar .trainus .domain .payment .entity .TossPayment ;
811
912public interface TossPaymentRepository extends JpaRepository <TossPayment , Long > {
1013
1114 Optional <TossPayment > findByOrderId (String orderId );
15+
16+ @ Query ("""
17+ SELECT t FROM TossPayment t
18+ WHERE t.orderId IN :orderIds
19+ """ )
20+ List <TossPayment > findAllByOrderIds (@ Param ("orderIds" ) List <String > orderIds );
1221}
You can’t perform that action at this time.
0 commit comments