- tag_category_board 매핑 테이블 추가(그룹 ↔ community/saving/tips) - TagCategory 응답에 boards 추가, 생성/수정 시 매핑 저장(유효 게시판만) - listWritableGroups(category): 해당 게시판에 매핑된 그룹만(매핑 없으면 전체=하위호환) - GET /board/tag-groups?category=... 로 게시판별 필터 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -54,6 +54,15 @@ CREATE TABLE IF NOT EXISTS tag (
|
||||
-- 기존 tag 테이블에 category_id 가 없으면 추가 (멱등)
|
||||
ALTER TABLE tag ADD COLUMN IF NOT EXISTS category_id BIGINT NULL;
|
||||
|
||||
-- 태그 카테고리(그룹) ↔ 게시판 매핑. 어느 게시판(community/saving/tips)에서 이 그룹을 쓸지 지정.
|
||||
-- 매핑이 하나도 없는 카테고리는 모든 게시판에서 사용(하위호환).
|
||||
CREATE TABLE IF NOT EXISTS tag_category_board (
|
||||
tag_category_id BIGINT NOT NULL,
|
||||
board_category VARCHAR(30) NOT NULL COMMENT 'community / saving / tips',
|
||||
PRIMARY KEY (tag_category_id, board_category),
|
||||
KEY idx_tcb_board (board_category)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- 게시글-태그 (다대다)
|
||||
CREATE TABLE IF NOT EXISTS post_tag (
|
||||
post_id BIGINT NOT NULL,
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?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.TagCategoryBoardMapper">
|
||||
|
||||
<select id="findBoards" parameterType="long" resultType="string">
|
||||
SELECT board_category FROM tag_category_board WHERE tag_category_id = #{categoryId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteByCategory" parameterType="long">
|
||||
DELETE FROM tag_category_board WHERE tag_category_id = #{categoryId}
|
||||
</delete>
|
||||
|
||||
<insert id="insert">
|
||||
INSERT INTO tag_category_board (tag_category_id, board_category)
|
||||
VALUES (#{categoryId}, #{board})
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user