feature/cash_bookings #55

Merged
Seil0 merged 6 commits from feature/cash_bookings into master 2020-06-10 19:04:45 +02:00
Showing only changes of commit 6f90b9c941 - Show all commits

View File

@ -13,16 +13,16 @@ public interface BookingRepository extends JpaRepository<Booking, Long> {
@Query("SELECT b FROM Booking b ORDER BY b.id DESC")
List<Booking> allBookingsReverseChronologically();
@Query("SELECT b FROM Booking b WHERE b.source.isMainAccount = 1 OR b.destination.isMainAccount = 1 ORDER BY b.id DESC")
@Query("SELECT b FROM Booking b LEFT JOIN b.source s LEFT JOIN b.destination d WHERE s.isMainAccount = 1 OR d.isMainAccount = 1 ORDER BY b.id DESC")
List<Booking> mainBookingsReverseChronologically();
@Query("SELECT b FROM Booking b WHERE b.source.isVATAccount = 1 OR b.destination.isVATAccount = 1 ORDER BY b.id DESC")
@Query("SELECT b FROM Booking b LEFT JOIN b.source s LEFT JOIN b.destination d WHERE s.isVATAccount = 1 OR d.isVATAccount = 1 ORDER BY b.id DESC")
List<Booking> vatBookingsReverseChronologically();
@Query("SELECT b FROM Booking b WHERE b.source.userAccount.id = :customerId OR b.destination.userAccount.id = :customerId ORDER BY b.id DESC")
@Query("SELECT b FROM Booking b LEFT JOIN b.source s LEFT JOIN b.destination d WHERE s.userAccount.id = :customerId OR d.userAccount.id = :customerId ORDER BY b.id DESC")
List<Booking> customerBookingsReverseChronologically(long customerId);
@Query("SELECT b FROM Booking b WHERE b.source.supplierAccount.id = :supplierId OR b.destination.supplierAccount.id = :supplierId ORDER BY b.id DESC")
@Query("SELECT b FROM Booking b LEFT JOIN b.source s LEFT JOIN b.destination d WHERE s.supplierAccount.id = :supplierId OR d.supplierAccount.id = :supplierId ORDER BY b.id DESC")
List<Booking> supplierBookingsReverseChronologically(long supplierId);
}