-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into deploy/#167/springLogFileMount
- Loading branch information
Showing
34 changed files
with
597 additions
and
364 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
10 changes: 10 additions & 0 deletions
10
src/main/java/com/server/capple/domain/answer/dao/AnswerRDBDao.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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.server.capple.domain.answer.dao; | ||
|
||
import com.server.capple.domain.answer.entity.Answer; | ||
|
||
public class AnswerRDBDao { | ||
public interface AnswerInfoInterface { | ||
public Answer getAnswer(); | ||
public Boolean getIsReported(); | ||
} | ||
} |
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
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
28 changes: 15 additions & 13 deletions
28
src/main/java/com/server/capple/domain/answer/repository/AnswerRepository.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,32 +1,34 @@ | ||
package com.server.capple.domain.answer.repository; | ||
|
||
import com.server.capple.domain.answer.dao.AnswerRDBDao.AnswerInfoInterface; | ||
import com.server.capple.domain.answer.entity.Answer; | ||
import com.server.capple.domain.member.entity.Member; | ||
import com.server.capple.domain.question.entity.Question; | ||
import io.lettuce.core.dynamic.annotation.Param; | ||
import java.util.List; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.domain.Slice; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
|
||
import java.util.Optional; | ||
import java.util.Set; | ||
|
||
public interface AnswerRepository extends JpaRepository<Answer, Long> { | ||
Optional<Answer> findById(Long answerId); | ||
|
||
boolean existsByQuestionAndMember(Question question, Member member); | ||
Slice<Answer> findByIdIn(Set<Long> answerIds, Pageable pageable); | ||
|
||
@Query("SELECT a FROM Answer a WHERE a.question.id = :questionId ORDER BY a.createdAt DESC") | ||
Optional<List<Answer>> findByQuestion( | ||
@Param("questionId") Long questionId, | ||
Pageable pageable); | ||
boolean existsByQuestionAndMember(Question question, Member member); | ||
|
||
@Query("SELECT a FROM Answer a WHERE a.question.id = :questionId AND a.content LIKE %:keyword%") | ||
Optional<List<Answer>> findByQuestionAndKeyword( | ||
@Param("questionId") Long questionId, | ||
@Param("keyword") String keyword, | ||
Pageable pageable); | ||
@Query("SELECT a AS answer, (r IS NOT NULL) AS isReported " + | ||
"FROM Answer a " + | ||
"LEFT JOIN " + | ||
"Report r ON r.answer = a " + | ||
"WHERE a.question.id = :questionId") | ||
Slice<AnswerInfoInterface> findByQuestion( | ||
@Param("questionId") Long questionId, | ||
Pageable pageable); | ||
|
||
@Query("SELECT a FROM Answer a WHERE a.member = :member and a.deletedAt is null ORDER BY a.createdAt DESC") | ||
Optional<List<Answer>> findByMember(@Param("member") Member member); | ||
@Query("SELECT a FROM Answer a WHERE a.member = :member and a.deletedAt is null") | ||
Slice<Answer> findByMember(@Param("member") Member member, Pageable pageable); | ||
} |
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
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
Oops, something went wrong.