Skip to content

Commit

Permalink
FIX: 폼 조회 시 유저가 작성한 폼의 상태에 따라 조회하는 기능
Browse files Browse the repository at this point in the history
  • Loading branch information
saewoo1 committed Nov 1, 2024
1 parent 9964715 commit 3ee1cfb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.time.LocalDateTime;
import java.util.List;
import org.ftclub.cabinet.presentation.domain.Presentation;
import org.ftclub.cabinet.presentation.domain.PresentationStatus;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.EntityGraph;
Expand All @@ -25,10 +26,13 @@ List<Presentation> findAllByDateTimeBetweenOrderByDateTime(LocalDateTime start,

@Query("SELECT p "
+ "FROM Presentation p "
+ "WHERE p.user IS NOT NULL AND "
+ "p.dateTime BETWEEN :start AND :end")
+ "WHERE p.user IS NOT NULL "
+ "AND p.presentationStatus = :status "
+ "AND p.dateTime BETWEEN :start AND :end")
List<Presentation> findAllBetweenAndNotNullUser(
@Param("start") LocalDateTime start,
@Param("end") LocalDateTime end,
Pageable pageable);
@Param("status") PresentationStatus status,
Pageable pageable
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,8 @@ public List<Presentation> findUserFormsWithStatusWithinPeriod(
LocalDateTime start,
LocalDateTime end,
PageRequest pageRequest,
PresentationStatus presentationStatus) {
List<Presentation> userForms = presentationRepository.findAllBetweenAndNotNullUser(
start, end, pageRequest);

return userForms.stream()
.filter(form ->
form.getPresentationStatus().equals(presentationStatus))
.collect(Collectors.toList());
PresentationStatus status) {
return presentationRepository.findAllBetweenAndNotNullUser(
start, end, status, pageRequest);
}
}

0 comments on commit 3ee1cfb

Please sign in to comment.