-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ [Feature] 개인일정 기간 조회 API Service 기능 추가 #1061
- Loading branch information
taehyeon
committed
Jan 7, 2025
1 parent
b3ead11
commit 83be3a9
Showing
2 changed files
with
32 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 8 additions & 1 deletion
9
gg-repo/src/main/java/gg/repo/calendar/PrivateScheduleRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
package gg.repo.calendar; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import gg.data.calendar.PrivateSchedule; | ||
import gg.data.calendar.PublicSchedule; | ||
import gg.data.user.User; | ||
|
||
@Repository | ||
public interface PrivateScheduleRepository extends JpaRepository<PrivateSchedule, Long> { | ||
List<PrivateSchedule> findByPublicSchedule(PublicSchedule publicSchedule); | ||
|
||
List<PrivateSchedule> findByUserId(Long userId); | ||
@Query("SELECT pr FROM PrivateSchedule pr " | ||
+ "JOIN pr.publicSchedule pu " | ||
+ "WHERE NOT (pu.startTime > :endTime OR pu.endTime < :startTime) " | ||
+ "AND pr.user = :user") | ||
List<PrivateSchedule> findOverlappingSchedulesByUser(LocalDateTime startTime, LocalDateTime endTime, User user); | ||
} |