INSERT INTO `la_system_menu` (`pid`, `type`, `name`, `icon`, `sort`, `perms`, `paths`, `component`, `selected`, `params`, `is_cache`, `is_show`, `is_disable`, `create_time`, `update_time`)
SELECT 70, 'C', 'AI评论任务', '', 0, 'article.ai_comment_task/lists', 'ai_comment_task', 'article/ai_comment_task/index', '', '', 0, 1, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
WHERE NOT EXISTS (
    SELECT 1 FROM `la_system_menu`
    WHERE `perms` = 'article.ai_comment_task/lists'
);

INSERT INTO `la_system_role_menu` (`role_id`, `menu_id`)
SELECT 1, (SELECT id FROM `la_system_menu` WHERE `perms` = 'article.ai_comment_task/lists' LIMIT 1)
WHERE NOT EXISTS (
    SELECT 1 FROM `la_system_role_menu` rm
    JOIN `la_system_menu` m ON m.id = rm.menu_id
    WHERE m.perms = 'article.ai_comment_task/lists'
);
