Files
sb-backend/src/main/resources/mapper/CommentMapper.xml
T
ByungCheolandClaude Opus 4.8 ba75613e1c feat: 게시판 신고 — 누적 5건 시 블라인드(관리자만 열람)
- report 테이블(회원당 대상별 1회), comment.blocked 컬럼
- POST /board/posts|comments/{id}/report, 본인 글/댓글 신고 불가
- 글: 5건이면 blocked(기존 열람제한 재사용) / 댓글: blocked → 비관리자 본문 숨김
- 삭제·탈퇴 시 신고 정리

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 18:05:10 +09:00

54 lines
2.3 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sb.web.board.mapper.CommentMapper">
<resultMap id="commentResultMap" type="com.sb.web.board.domain.Comment">
<id property="id" column="id"/>
<result property="postId" column="post_id"/>
<result property="authorId" column="author_id"/>
<result property="authorName" column="author_name"/>
<result property="authorGooglePicture" column="author_google_picture"/>
<result property="authorProfileImage" column="author_profile_image"/>
<result property="content" column="content"/>
<result property="blocked" column="blocked"/>
<result property="createdAt" column="created_at"/>
</resultMap>
<select id="findByPostId" parameterType="long" resultMap="commentResultMap">
SELECT c.id, c.post_id, c.author_id, c.author_name, c.content, c.blocked, c.created_at,
m.google_picture AS author_google_picture, m.profile_image AS author_profile_image
FROM comment c
LEFT JOIN member m ON m.id = c.author_id
WHERE c.post_id = #{postId}
ORDER BY c.id ASC
</select>
<select id="findById" parameterType="long" resultMap="commentResultMap">
SELECT c.id, c.post_id, c.author_id, c.author_name, c.content, c.blocked, c.created_at,
m.google_picture AS author_google_picture, m.profile_image AS author_profile_image
FROM comment c
LEFT JOIN member m ON m.id = c.author_id
WHERE c.id = #{id}
</select>
<update id="updateBlocked">
UPDATE comment SET blocked = #{blocked} WHERE id = #{id}
</update>
<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)
VALUES (#{postId}, #{authorId}, #{authorName}, #{content}, NOW())
</insert>
<delete id="delete" parameterType="long">
DELETE FROM comment WHERE id = #{id}
</delete>
<delete id="deleteByPostId" parameterType="long">
DELETE FROM comment WHERE post_id = #{postId}
</delete>
</mapper>