Skip to content

Commit

Permalink
feat : 선택한 YYYY-MM-DD에 대한 질문, 답변 API
Browse files Browse the repository at this point in the history
  • Loading branch information
programmerDH-github committed Aug 16, 2023
1 parent 244d21d commit 143abd0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ else if (dateArr.length == 2) {
}
/* YYYY-MM-DD 입력했을 경우 */
else {
return ResponseEntity.ok("YYYY-MM 의 형식으로 입력해주세요.");
questionAndAnswers = questionService.getQuestionsAndAnswersByDayAndEmail(email, date);
}

if (questionAndAnswers.isEmpty()) {
Expand Down
5 changes: 3 additions & 2 deletions src/main/resources/sqlmap/mapper/question/QuestionMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
GROUP BY(DATE(a.a_created_at))
</select>

<!-- 선택한 년,월에 답변한 질문 조회 -->
<select id="getQuestionsAndAnswersByMonthAndEmail" resultType="com.bside.BSIDE.contents.domain.QuestionAndAnswerDto">
SELECT q.q_question AS question, a.a_answer_content AS answer, DATE(a.a_created_at) AS date, q.q_category AS category
FROM bside.answer a
Expand All @@ -138,9 +139,9 @@
AND MONTH(a.a_created_at) = MONTH(#{date})
</select>

<!-- 선택한 년,월에 답변한 질문 조회 -->
<!-- 선택한 년,월,일에 답변한 질문 조회 -->
<select id="getQuestionsAndAnswersByDayAndEmail" resultType="com.bside.BSIDE.contents.domain.QuestionAndAnswerDto">
SELECT q.q_question AS question, a.a_answer_content AS answer
SELECT q.q_question AS question, a.a_answer_content AS answer, DATE(a.a_created_at) AS date, q.q_category AS category
FROM bside.answer a
INNER JOIN bside.question q ON a.q_no = q.q_no
WHERE a.a_writer = #{email}
Expand Down

0 comments on commit 143abd0

Please sign in to comment.