Skip to content

Commit 4627a9b

Browse files
committed
refactor: DB 쿼리 수정
1 parent 16823d8 commit 4627a9b

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

storage/src/main/java/com/mangoboss/storage/schedule/ScheduleJpaRepository.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,17 @@ public interface ScheduleJpaRepository extends JpaRepository<ScheduleEntity, Lon
2626

2727
List<ScheduleEntity> findAllByStaffIdAndWorkDate(Long staffId, LocalDate date);
2828

29-
@Query("""
30-
SELECT s FROM ScheduleEntity s
31-
LEFT JOIN s.attendance a
32-
WHERE s.endTime <= :standardTime
33-
AND (a.clockOutStatus is NULL OR a is NULL)
34-
""")
35-
List<ScheduleEntity> findAllSchedulesWithoutClockOut(LocalDateTime standardTime);
29+
@Query("""
30+
SELECT s AS schedule, f.name AS staffName, st.boss.id AS bossId, st.id AS storeId
31+
FROM ScheduleEntity s
32+
JOIN StaffEntity f ON s.staff.id = f.id
33+
JOIN StoreEntity st ON f.store.id = st.id
34+
LEFT JOIN s.attendance a
35+
WHERE s.endTime <= :standardTime
36+
AND (a.clockOutStatus is NULL OR a is NULL)
37+
"""
38+
)
39+
List<ScheduleForNotificationProjection> findAllSchedulesWithoutClockOut(LocalDateTime standardTime);
3640

3741
Boolean existsByRegularGroupId(Long regularGroupId);
3842

0 commit comments

Comments
 (0)