diff --git a/src/main/java/com/taba/nimonaemo/diagnosis/repository/DiagnosisResultRepository.java b/src/main/java/com/taba/nimonaemo/diagnosis/repository/DiagnosisResultRepository.java index a60506f..af5bd56 100644 --- a/src/main/java/com/taba/nimonaemo/diagnosis/repository/DiagnosisResultRepository.java +++ b/src/main/java/com/taba/nimonaemo/diagnosis/repository/DiagnosisResultRepository.java @@ -13,11 +13,13 @@ public interface DiagnosisResultRepository extends JpaRepository { @Query("select d from DiagnosisResult d " + "where d.member.id = :memberId and " + + "d.member.status = 'ACTIVE' and " + "(d.diagnosisDate between TO_DATE(:curDate, 'YYYY/MM') and TO_DATE(:nextDate, 'YYYY/MM'))") List findByDate(Long memberId, String curDate, String nextDate); @Query("select d from DiagnosisResult d " + "where d.member.id = :memberId and " + + "d.member.status = 'ACTIVE' and " + "d.diagnosisDate = :date ") Optional findByDateForDetail(Long memberId, LocalDateTime date); @@ -25,11 +27,13 @@ public interface DiagnosisResultRepository extends JpaRepository { @Query("select s from Survey s " + "where s.member.id = :memberId and " + + "s.member.status = 'ACTIVE' and " + "s.surveyDate = :targetDate ") Optional findByDate(Long memberId, LocalDateTime targetDate); } diff --git a/src/main/java/com/taba/nimonaemo/record/repository/DiaryRepository.java b/src/main/java/com/taba/nimonaemo/record/repository/DiaryRepository.java index 2afbbe3..e0f5c0c 100644 --- a/src/main/java/com/taba/nimonaemo/record/repository/DiaryRepository.java +++ b/src/main/java/com/taba/nimonaemo/record/repository/DiaryRepository.java @@ -13,6 +13,7 @@ public interface DiaryRepository extends JpaRepository { @Query("select d from Diary d " + "where d.member.id = :memberId and " + + "d.member.status = 'ACTIVE' and " + "(d.diaryDate between TO_DATE(:curDate, 'YYYY/MM') and TO_DATE(:nextDate, 'YYYY/MM'))") List findByDate(Long memberId, String curDate, String nextDate); @@ -20,6 +21,7 @@ public interface DiaryRepository extends JpaRepository { @Modifying @Query("delete from Diary d " + "where d.member.id = :memberId and " + + "d.member.status = 'ACTIVE' and " + "d.id = :diaryId ") void deleteByDate(Long memberId, Long diaryId); } \ No newline at end of file diff --git a/src/main/java/com/taba/nimonaemo/record/repository/HairStatusRepository.java b/src/main/java/com/taba/nimonaemo/record/repository/HairStatusRepository.java index f2cdbf4..8c8518e 100644 --- a/src/main/java/com/taba/nimonaemo/record/repository/HairStatusRepository.java +++ b/src/main/java/com/taba/nimonaemo/record/repository/HairStatusRepository.java @@ -8,6 +8,7 @@ public interface HairStatusRepository extends JpaRepository { @Query("select h from HairStatus h " + - "where h.member.id = :memberId ") + "where h.member.id = :memberId and " + + "h.member.status = 'ACTIVE'") Optional findByMemberId(Long memberId); }