Skip to content

Commit

Permalink
[fix] fix query to exclude debate participations without comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Parkjyun committed May 12, 2024
1 parent 0826839 commit c2a6faa
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ public interface DebateParticipationJpaRepository extends JpaRepository<DebatePa

Optional<DebateParticipation> findByDebateAndMember(Debate debate, Member member);

@Query("select dp from DebateParticipation dp join fetch dp.member where dp.debate.id = :debateId order by dp.id desc")
@Query("select dp from DebateParticipation dp join fetch dp.member where dp.debate.id = :debateId and dp.comment is not null order by dp.id desc")
List<DebateParticipation> findAllWithMemberByDebateIdOrderByIdDescJPQL(Long debateId);

@Query("select dp from DebateParticipation dp join fetch dp.member where dp.debate.id = :debateId order by dp.heartCount desc, dp.id desc")
@Query("select dp from DebateParticipation dp join fetch dp.member where dp.debate.id = :debateId and dp.comment is not null order by dp.heartCount desc, dp.id desc")
List<DebateParticipation> findAllWithMemberByDebateIdOrderByHeartCountDescJPQL(Long debateId);

@Query("select distinct dp from DebateParticipation dp left join fetch dp.debateParticipationHearts join fetch dp.member where dp.debate.id = :debateId order by dp.id desc")
@Query("select distinct dp from DebateParticipation dp left join fetch dp.debateParticipationHearts join fetch dp.member where dp.debate.id = :debateId and dp.comment is not null order by dp.id desc")
List<DebateParticipation> findAllWithMemberAndDebateParticipationHeartByDebateIdOrderByIdDescJPQL(Long debateId);

@Query("select distinct dp from DebateParticipation dp left join fetch dp.debateParticipationHearts join fetch dp.member where dp.debate.id = :debateId order by dp.heartCount desc, dp.id desc")
@Query("select distinct dp from DebateParticipation dp left join fetch dp.debateParticipationHearts join fetch dp.member where dp.debate.id = :debateId and dp.comment is not null order by dp.heartCount desc, dp.id desc")
List<DebateParticipation> findAllWithMemberAndDebateParticipationHeartByDebateIdOrderByHeartCountDescJPQL(Long debateId);

@Query("select dp from DebateParticipation dp join fetch dp.debate where dp.member.id = :memberId order by dp.id desc")
Expand Down

0 comments on commit c2a6faa

Please sign in to comment.