Fix a bug where bookings were invisible if they affected only one account

This commit is contained in:
Lukas Fürderer 2020-06-05 18:58:16 +02:00
parent e53c1e0872
commit 6f90b9c941
Signed by: Lukas
GPG Key ID: B0AFA46F94103349
1 changed files with 4 additions and 4 deletions

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);
}