Skip to content

Commit 465cf0f

Browse files
authored
fix: entity 컬럼 변경 (#166)
1 parent 0881001 commit 465cf0f

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/main/java/com/threestar/trainus/domain/payment/entity/Payment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class Payment extends BaseDateEntity {
3737

3838
@Id
3939
@GeneratedValue(strategy = GenerationType.IDENTITY)
40-
private Long paymentId;
40+
private Long id;
4141

4242
@ManyToOne(fetch = FetchType.LAZY)
4343
@JoinColumn(name = "user_id", nullable = false)

src/main/java/com/threestar/trainus/domain/payment/repository/PaymentRepository.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Optional<Payment> findByUserAndLessonAndUserCouponAndStatus(User user, Lesson le
2222
Optional<Payment> findByUserAndLessonAndUserCouponIsNullAndStatus(User user, Lesson lesson, PaymentStatus status);
2323

2424
@Query(value = """
25-
SELECT p.payment_id FROM payments p
25+
SELECT p.id FROM payments p
2626
WHERE p.user_id = :userId
2727
AND p.status = :status
2828
ORDER BY p.pay_date DESC
@@ -39,12 +39,12 @@ List<Long> findPaymentIdsByUserAndStatus(
3939
SELECT p FROM Payment p
4040
LEFT JOIN FETCH p.lesson
4141
LEFT JOIN FETCH p.userCoupon
42-
WHERE p.paymentId IN :ids
42+
WHERE p.id IN :ids
4343
""")
4444
List<Payment> findAllWithAssociationsByIds(@Param("ids") List<Long> ids);
4545

4646
@Query(value = """
47-
SELECT count(*) FROM (SELECT payment_id FROM payments WHERE user_id = :userId AND status = :status LIMIT :limit) t
47+
SELECT count(*) FROM (SELECT id FROM payments WHERE user_id = :userId AND status = :status LIMIT :limit) t
4848
""", nativeQuery = true
4949
)
5050
Integer count(

src/main/java/com/threestar/trainus/domain/payment/service/PaymentService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public PaymentSuccessHistoryPageDto viewAllSuccessTransaction(Long userId, int p
198198

199199
List<Payment> payments = paymentRepository.findAllWithAssociationsByIds(paymentIds);
200200
Map<Long, Payment> map = payments.stream()
201-
.collect(Collectors.toMap(Payment::getPaymentId, p -> p));
201+
.collect(Collectors.toMap(Payment::getId, p -> p));
202202
List<Payment> allSuccessPayments = paymentIds.stream()
203203
.map(map::get)
204204
.toList();
@@ -228,7 +228,7 @@ public PaymentCancelHistoryPageDto viewAllFailureTransaction(Long userId, int pa
228228

229229
List<Payment> payments = paymentRepository.findAllWithAssociationsByIds(paymentIds);
230230
Map<Long, Payment> map = payments.stream()
231-
.collect(Collectors.toMap(Payment::getPaymentId, p -> p));
231+
.collect(Collectors.toMap(Payment::getId, p -> p));
232232
List<Payment> allFailurePayments = paymentIds.stream()
233233
.map(map::get)
234234
.toList();

0 commit comments

Comments
 (0)