-- 添加知识库管理相关的菜单项
-- 注意：需要先查询知识库菜单的ID（parent_id），假设为 11

-- 如果知识库菜单ID为11，添加分类管理和标签管理菜单
-- 请根据实际数据库中的知识库菜单ID修改下面的 parent_id 值

-- 查询知识库菜单ID（如果需要）
-- SELECT id FROM yz_menus WHERE path = '/apps/knowledge';

-- 添加分类管理菜单（如果不存在）
INSERT INTO yz_menus (
    name, 
    path, 
    parent_id, 
    icon, 
    `order`, 
    status, 
    component_path, 
    menu_type, 
    description
)
SELECT 
    '分类管理', 
    '/apps/knowledge/category', 
    id, 
    'fa-solid fa-folder', 
    2, 
    1, 
    '@/views/apps/knowledge/category/index.vue', 
    1, 
    '知识库分类管理'
FROM yz_menus 
WHERE path = '/apps/knowledge' 
AND NOT EXISTS (
    SELECT 1 FROM yz_menus WHERE path = '/apps/knowledge/category'
);

-- 添加标签管理菜单（如果不存在）
INSERT INTO yz_menus (
    name, 
    path, 
    parent_id, 
    icon, 
    `order`, 
    status, 
    component_path, 
    menu_type, 
    description
)
SELECT 
    '标签管理', 
    '/apps/knowledge/tag', 
    id, 
    'fa-solid fa-tags', 
    3, 
    1, 
    '@/views/apps/knowledge/tag/index.vue', 
    1, 
    '知识库标签管理'
FROM yz_menus 
WHERE path = '/apps/knowledge' 
AND NOT EXISTS (
    SELECT 1 FROM yz_menus WHERE path = '/apps/knowledge/tag'
);

