Add pending amount to booking list
All checks were successful
build-and-deploy / build-deploy (push) Successful in 39s

This commit is contained in:
androidlover5842
2026-01-29 22:17:00 +05:30
parent b765f041f7
commit 0464c804cc
4 changed files with 48 additions and 2 deletions

View File

@@ -17,4 +17,19 @@ interface PaymentRepo : JpaRepository<Payment, UUID> {
"""
)
fun sumAmountByBookingId(@Param("bookingId") bookingId: UUID): Long
@Query(
"""
select p.booking.id as bookingId, coalesce(sum(p.amount), 0) as total
from Payment p
where p.booking.id in :bookingIds
group by p.booking.id
"""
)
fun sumAmountByBookingIds(@Param("bookingIds") bookingIds: List<UUID>): List<BookingPaymentSumRow>
}
interface BookingPaymentSumRow {
val bookingId: UUID
val total: Long
}

View File

@@ -43,6 +43,13 @@ interface RoomStayRepo : JpaRepository<RoomStay, UUID> {
""")
fun findByBookingId(@Param("bookingId") bookingId: UUID): List<RoomStay>
@Query("""
select rs
from RoomStay rs
where rs.booking.id in :bookingIds
""")
fun findByBookingIdIn(@Param("bookingIds") bookingIds: List<UUID>): List<RoomStay>
@Query("""
select rs.room.id
from RoomStay rs