feat(ai): add three-level FAQ category management
- add FAQ category table/sql migration and initialize ddl updates - add category service/controller with validation, default category rules, and sorting - support faq item category binding and category-based filtering (include descendants) - redesign FAQ page with category tree actions and UI polish
This commit is contained in:
@@ -285,6 +285,31 @@ CREATE TABLE `tb_document_collection_category`
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for tb_faq_category
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `tb_faq_category`;
|
||||
CREATE TABLE `tb_faq_category`
|
||||
(
|
||||
`id` bigint UNSIGNED NOT NULL COMMENT '主键',
|
||||
`collection_id` bigint UNSIGNED NOT NULL COMMENT '知识库ID',
|
||||
`parent_id` bigint UNSIGNED NOT NULL DEFAULT 0 COMMENT '父分类ID,0表示根',
|
||||
`ancestors` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '0' COMMENT '祖先路径(逗号分隔)',
|
||||
`level_no` tinyint UNSIGNED NOT NULL DEFAULT 1 COMMENT '层级(1-3)',
|
||||
`category_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '分类名称',
|
||||
`sort_no` int NOT NULL DEFAULT 0 COMMENT '排序',
|
||||
`is_default` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否默认分类',
|
||||
`status` int NOT NULL DEFAULT 0 COMMENT '数据状态',
|
||||
`created` datetime NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`created_by` bigint UNSIGNED NULL DEFAULT NULL COMMENT '创建人',
|
||||
`modified` datetime NULL DEFAULT NULL COMMENT '更新时间',
|
||||
`modified_by` bigint UNSIGNED NULL DEFAULT NULL COMMENT '更新人',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_faq_category_collection_parent_sort`(`collection_id`, `parent_id`, `sort_no`) USING BTREE,
|
||||
INDEX `idx_faq_category_collection_level`(`collection_id`, `level_no`) USING BTREE,
|
||||
INDEX `idx_faq_category_collection_status`(`collection_id`, `status`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'FAQ分类' ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for tb_faq_item
|
||||
-- ----------------------------
|
||||
@@ -293,6 +318,7 @@ CREATE TABLE `tb_faq_item`
|
||||
(
|
||||
`id` bigint UNSIGNED NOT NULL COMMENT '主键',
|
||||
`collection_id` bigint UNSIGNED NOT NULL COMMENT '知识库ID',
|
||||
`category_id` bigint UNSIGNED NULL DEFAULT NULL COMMENT 'FAQ分类ID',
|
||||
`question` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '问题',
|
||||
`answer_html` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '答案HTML',
|
||||
`answer_text` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '答案纯文本',
|
||||
@@ -304,7 +330,8 @@ CREATE TABLE `tb_faq_item`
|
||||
`modified_by` bigint UNSIGNED NULL DEFAULT NULL COMMENT '更新人',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_faq_collection_id`(`collection_id`) USING BTREE,
|
||||
INDEX `idx_faq_collection_order`(`collection_id`, `order_no`) USING BTREE
|
||||
INDEX `idx_faq_collection_order`(`collection_id`, `order_no`) USING BTREE,
|
||||
INDEX `idx_faq_collection_category_order`(`collection_id`, `category_id`, `order_no`) USING BTREE
|
||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'FAQ条目' ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
|
||||
Reference in New Issue
Block a user