@@ -31,24 +31,21 @@ Page<Event> findAllByAdminFilters(@Param("users") List<Long> users,
3131 @ Param ("rangeEnd" ) LocalDateTime rangeEnd ,
3232 Pageable pageable );
3333
34- @ Query (value = "SELECT DISTINCT e.* FROM events e " +
35- "LEFT JOIN categories c ON c.id = e.category_id " +
36- "LEFT JOIN users u ON u.id = e.initiator_id " +
34+ @ Query ("SELECT DISTINCT e FROM Event e " +
35+ "LEFT JOIN FETCH e.category " +
36+ "LEFT JOIN FETCH e.initiator " +
3737 "WHERE e.state = 'PUBLISHED' " +
38- "AND (:text IS NULL OR (LOWER(e.annotation::text) LIKE LOWER(CONCAT('%', :text, '%')) " +
39- "OR LOWER(e.description::text) LIKE LOWER(CONCAT('%', :text, '%')))) " +
40- "AND (:categories IS NULL OR e.category_id IN (:categories)) " +
38+ "AND (:text IS NULL OR LOWER(e.annotation) LIKE LOWER(CONCAT('%', :text, '%')) OR LOWER(e.description) LIKE LOWER(CONCAT('%', :text, '%'))) " +
39+ "AND (:categories IS NULL OR e.category.id IN :categories) " +
4140 "AND (:paid IS NULL OR e.paid = :paid) " +
42- "AND (:rangeStart IS NULL OR e.event_date >= :rangeStart) " +
43- "AND (:rangeEnd IS NULL OR e.event_date <= :rangeEnd) " +
44- "OFFSET :offset ROWS FETCH NEXT :size ROWS ONLY" , nativeQuery = true )
45- List <Event > findPublishedEventsWithFilters (@ Param ("text" ) String text ,
41+ "AND (:rangeStart IS NULL OR e.eventDate >= :rangeStart) " +
42+ "AND (:rangeEnd IS NULL OR e.eventDate <= :rangeEnd)" )
43+ Page <Event > findPublishedEventsWithFilters (@ Param ("text" ) String text ,
4644 @ Param ("categories" ) List <Long > categories ,
4745 @ Param ("paid" ) Boolean paid ,
4846 @ Param ("rangeStart" ) LocalDateTime rangeStart ,
4947 @ Param ("rangeEnd" ) LocalDateTime rangeEnd ,
50- @ Param ("offset" ) int offset ,
51- @ Param ("size" ) int size );
48+ Pageable pageable );
5249
5350 @ Query ("SELECT COUNT(r) FROM Request r WHERE r.event.id = :eventId AND r.status = 'CONFIRMED'" )
5451 Long countConfirmedRequests (@ Param ("eventId" ) Long eventId );
0 commit comments