Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class Payment extends BaseDateEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long paymentId;
private Long id;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id", nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Optional<Payment> findByUserAndLessonAndUserCouponAndStatus(User user, Lesson le
Optional<Payment> findByUserAndLessonAndUserCouponIsNullAndStatus(User user, Lesson lesson, PaymentStatus status);

@Query(value = """
SELECT p.payment_id FROM payments p
SELECT p.id FROM payments p
WHERE p.user_id = :userId
AND p.status = :status
ORDER BY p.pay_date DESC
Expand All @@ -39,12 +39,12 @@ List<Long> findPaymentIdsByUserAndStatus(
SELECT p FROM Payment p
LEFT JOIN FETCH p.lesson
LEFT JOIN FETCH p.userCoupon
WHERE p.paymentId IN :ids
WHERE p.id IN :ids
""")
List<Payment> findAllWithAssociationsByIds(@Param("ids") List<Long> ids);

@Query(value = """
SELECT count(*) FROM (SELECT payment_id FROM payments WHERE user_id = :userId AND status = :status LIMIT :limit) t
SELECT count(*) FROM (SELECT id FROM payments WHERE user_id = :userId AND status = :status LIMIT :limit) t
""", nativeQuery = true
)
Integer count(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public PaymentSuccessHistoryPageDto viewAllSuccessTransaction(Long userId, int p

List<Payment> payments = paymentRepository.findAllWithAssociationsByIds(paymentIds);
Map<Long, Payment> map = payments.stream()
.collect(Collectors.toMap(Payment::getPaymentId, p -> p));
.collect(Collectors.toMap(Payment::getId, p -> p));
List<Payment> allSuccessPayments = paymentIds.stream()
.map(map::get)
.toList();
Expand Down Expand Up @@ -228,7 +228,7 @@ public PaymentCancelHistoryPageDto viewAllFailureTransaction(Long userId, int pa

List<Payment> payments = paymentRepository.findAllWithAssociationsByIds(paymentIds);
Map<Long, Payment> map = payments.stream()
.collect(Collectors.toMap(Payment::getPaymentId, p -> p));
.collect(Collectors.toMap(Payment::getId, p -> p));
List<Payment> allFailurePayments = paymentIds.stream()
.map(map::get)
.toList();
Expand Down