Skip to content

Commit f610774

Browse files
committed
fix: 하이버네이트 수정
1 parent 2a2f4fe commit f610774

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

src/main/java/com/waitit/capstone/domain/dashboard/repository/WaitingHistoryRepository.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,21 @@
1111

1212
public interface WaitingHistoryRepository extends JpaRepository<WaitingHistory, Long> {
1313

14-
/**
15-
* 특정 기간 동안의 시간대별 평균 대기 인원을 계산합니다.
16-
*/
17-
@Query("SELECT new com.waitit.capstone.domain.dashboard.dto.HourlyWaitingStats(FUNCTION('HOUR', w.recordedAt), AVG(w.queueSize)) " +
18-
"FROM WaitingHistory w " +
19-
"WHERE w.host.id = :hostId AND w.recordedAt BETWEEN :startDate AND :endDate " +
20-
"GROUP BY FUNCTION('HOUR', w.recordedAt) " +
21-
"ORDER BY FUNCTION('HOUR', w.recordedAt)")
14+
@Query("""
15+
SELECT new com.waitit.capstone.domain.dashboard.dto.HourlyWaitingStats(
16+
HOUR(w.recordedAt),
17+
AVG(w.queueSize)
18+
)
19+
FROM WaitingHistory w
20+
WHERE w.host.id = :hostId
21+
AND w.recordedAt BETWEEN :startDate AND :endDate
22+
GROUP BY HOUR(w.recordedAt)
23+
ORDER BY HOUR(w.recordedAt)
24+
""")
2225
List<HourlyWaitingStats> findHourlyAverageQueueSize(
2326
@Param("hostId") Long hostId,
2427
@Param("startDate") LocalDateTime startDate,
25-
@Param("endDate") LocalDateTime endDate);
28+
@Param("endDate") LocalDateTime endDate
29+
);
2630

2731
}

0 commit comments

Comments
 (0)