Skip to content

Commit

Permalink
fix: 멤버 status 확인 로직 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
kjungw1025 committed Dec 16, 2023
1 parent fb269c7 commit 0a71f94
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,27 @@
public interface DiagnosisResultRepository extends JpaRepository<DiagnosisResult, Long> {
@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<DiagnosisResult> 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<DiagnosisResult> findByDateForDetail(Long memberId, LocalDateTime date);

@Transactional
@Modifying
@Query("delete from DiagnosisResult d " +
"where d.member.id = :memberId and " +
"d.member.status = 'ACTIVE' and " +
"d.diagnosisDate LIKE CONCAT(:targetDate, '%')")
void deleteByDate(Long memberId, LocalDateTime targetDate);

@Query("select COUNT(*) from DiagnosisResult d " +
"where d.member.id = (select m.id from Member m " +
"where m.nickname = :nickname) ")
"where m.nickname = :nickname) and " +
"d.member.status = 'ACTIVE'")
Long findAllWithNickname(String nickname);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
public interface SurveyRepository extends JpaRepository<Survey, Long> {
@Query("select s from Survey s " +
"where s.member.id = :memberId and " +
"s.member.status = 'ACTIVE' and " +
"s.surveyDate = :targetDate ")
Optional<Survey> findByDate(Long memberId, LocalDateTime targetDate);
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ public interface DiaryRepository extends JpaRepository<Diary, Long> {

@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<Diary> findByDate(Long memberId, String curDate, String nextDate);

@Transactional
@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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

public interface HairStatusRepository extends JpaRepository<HairStatus, Long> {
@Query("select h from HairStatus h " +
"where h.member.id = :memberId ")
"where h.member.id = :memberId and " +
"h.member.status = 'ACTIVE'")
Optional<HairStatus> findByMemberId(Long memberId);
}

0 comments on commit 0a71f94

Please sign in to comment.