feat: 내 글/댓글 모아보기 API
CI / build (push) Successful in 59s

- GET /board/my/posts, /board/my/comments (페이징)
- PostSummary 에 category 추가, MyCommentResponse(글 제목·카테고리 포함)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ByungCheol
2026-06-28 18:25:48 +09:00
parent ddcd6f4335
commit b969ba6104
8 changed files with 98 additions and 0 deletions
@@ -36,6 +36,19 @@
UPDATE comment SET blocked = #{blocked} WHERE id = #{id}
</update>
<select id="findMyPage" resultType="com.sb.web.board.dto.MyCommentResponse">
SELECT c.id, c.content, c.created_at, p.id AS post_id, p.title AS post_title, p.category
FROM comment c
JOIN post p ON p.id = c.post_id
WHERE c.author_id = #{memberId}
ORDER BY c.id DESC
LIMIT #{size} OFFSET #{offset}
</select>
<select id="countMyComments" parameterType="long" resultType="long">
SELECT COUNT(*) FROM comment WHERE author_id = #{memberId}
</select>
<insert id="insert" parameterType="com.sb.web.board.domain.Comment"
useGeneratedKeys="true" keyProperty="id">
INSERT INTO comment (post_id, author_id, author_name, content, created_at)
+19
View File
@@ -71,6 +71,25 @@
<include refid="filter"/>
</select>
<!-- 내 글 모아보기 -->
<select id="findMyPage" resultType="com.sb.web.board.dto.PostSummary">
SELECT
p.id, p.title, p.category, p.author_id, p.author_name, p.view_count, p.blocked, p.notice, p.created_at,
m.google_picture AS author_google_picture, m.profile_image AS author_profile_image,
(SELECT COUNT(*) FROM comment c WHERE c.post_id = p.id) AS comment_count,
(SELECT COUNT(*) FROM post_vote v WHERE v.post_id = p.id AND v.vote_type = 'UP') AS up_count,
(SELECT COUNT(*) FROM post_vote v WHERE v.post_id = p.id AND v.vote_type = 'DOWN') AS down_count
FROM post p
LEFT JOIN member m ON m.id = p.author_id
WHERE p.author_id = #{memberId}
ORDER BY p.id DESC
LIMIT #{size} OFFSET #{offset}
</select>
<select id="countMyPosts" parameterType="long" resultType="long">
SELECT COUNT(*) FROM post WHERE author_id = #{memberId}
</select>
<select id="findById" parameterType="long" resultType="com.sb.web.board.domain.Post">
SELECT p.id, p.title, p.content, p.author_id, p.author_name, p.view_count,
p.blocked, p.block_reason, p.notice, p.category, p.created_at, p.updated_at,