feat: 게시판 공지 기능 (관리자) — 목록 최상단 고정
CI / build (push) Failing after 14m19s

- post.notice 컬럼 추가(멱등 ALTER)
- 목록 정렬 ORDER BY notice DESC, id DESC (공지 최상단)
- 작성 시 공지 설정(관리자만 반영) + /posts/{id}/notice·unnotice 토글
- Post/PostSummary/PostDetail/PostRequest 에 notice 반영

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ByungCheol
2026-06-27 22:06:48 +09:00
parent b48d8c667c
commit 8d8d26ec3a
9 changed files with 50 additions and 5 deletions
+9 -5
View File
@@ -35,11 +35,11 @@
<select id="findPage" resultType="com.sb.web.board.dto.PostSummary">
SELECT
p.id, p.title, p.author_name, p.view_count, p.blocked, p.created_at,
p.id, p.title, p.author_name, p.view_count, p.blocked, p.notice, p.created_at,
(SELECT COUNT(*) FROM comment c WHERE c.post_id = p.id) AS comment_count
FROM post p
<include refid="filter"/>
ORDER BY p.id DESC
ORDER BY p.notice DESC, p.id DESC
LIMIT #{size} OFFSET #{offset}
</select>
@@ -51,15 +51,15 @@
<select id="findById" parameterType="long" resultType="com.sb.web.board.domain.Post">
SELECT id, title, content, author_id, author_name, view_count,
blocked, block_reason, category, created_at, updated_at
blocked, block_reason, notice, category, created_at, updated_at
FROM post
WHERE id = #{id}
</select>
<insert id="insert" parameterType="com.sb.web.board.domain.Post"
useGeneratedKeys="true" keyProperty="id">
INSERT INTO post (title, content, author_id, author_name, view_count, category, created_at, updated_at)
VALUES (#{title}, #{content}, #{authorId}, #{authorName}, 0, #{category}, NOW(), NOW())
INSERT INTO post (title, content, author_id, author_name, view_count, notice, category, created_at, updated_at)
VALUES (#{title}, #{content}, #{authorId}, #{authorName}, 0, #{notice}, #{category}, NOW(), NOW())
</insert>
<update id="update" parameterType="com.sb.web.board.domain.Post">
@@ -80,4 +80,8 @@
UPDATE post SET blocked = #{blocked}, block_reason = #{blockReason} WHERE id = #{id}
</update>
<update id="updateNotice">
UPDATE post SET notice = #{notice} WHERE id = #{id}
</update>
</mapper>