Add pending amount to booking list
All checks were successful
build-and-deploy / build-deploy (push) Successful in 39s
All checks were successful
build-and-deploy / build-deploy (push) Successful in 39s
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user