-- 档案管理菜单（可选：若使用动态菜单，执行本脚本后可在侧栏看到「档案管理」）
-- 执行前请先执行 archive_tables.sql

START TRANSACTION;

DELETE FROM sys_permission WHERE id IN ('ARCHIVE_MENU_ROOT_0001', 'ARCHIVE_MENU_LIST_0001', 'ARCHIVE_MENU_FORM_0001', 'ARCHIVE_MENU_DETAIL_0001');

-- 一级菜单：档案管理
INSERT INTO sys_permission (
  id, parent_id, name, url, component, component_name, redirect,
  menu_type, perms, perms_type, sort_no, always_show, icon,
  is_route, is_leaf, keep_alive, hidden, hide_tab, description,
  create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external
) VALUES (
  'ARCHIVE_MENU_ROOT_0001', '', '档案管理', '/archive', 'layouts/RouteView', NULL, '/archive/account/list',
  0, NULL, '1', 40.00, 0, 'folder',
  1, 0, 0, 0, 0, '档案账号与资质文件管理',
  'admin', NOW(), NULL, NULL, 0, 0, '1', 0
);

-- 子菜单：档案账号列表
INSERT INTO sys_permission (
  id, parent_id, name, url, component, component_name, redirect,
  menu_type, perms, perms_type, sort_no, always_show, icon,
  is_route, is_leaf, keep_alive, hidden, hide_tab, description,
  create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external
) VALUES (
  'ARCHIVE_MENU_LIST_0001', 'ARCHIVE_MENU_ROOT_0001', '档案账号列表', '/archive/account/list', 'archive/ArchiveAccountList', NULL, NULL,
  1, 'archive:account:list', '1', 1.00, 0, 'user',
  1, 1, 0, 0, 0, NULL,
  'admin', NOW(), NULL, NULL, 0, 0, '1', 0
);

-- 子菜单：新建/编辑（hidden，通过列表跳转）
INSERT INTO sys_permission (
  id, parent_id, name, url, component, component_name, redirect,
  menu_type, perms, perms_type, sort_no, always_show, icon,
  is_route, is_leaf, keep_alive, hidden, hide_tab, description,
  create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external
) VALUES (
  'ARCHIVE_MENU_FORM_0001', 'ARCHIVE_MENU_ROOT_0001', '新建/编辑档案子账号', '/archive/account/form', 'archive/ArchiveAccountForm', NULL, NULL,
  1, 'archive:account:add', '1', 2.00, 0, NULL,
  1, 1, 0, 1, 0, NULL,
  'admin', NOW(), NULL, NULL, 0, 0, '1', 0
);

-- 子菜单：档案账号详情（hidden）
INSERT INTO sys_permission (
  id, parent_id, name, url, component, component_name, redirect,
  menu_type, perms, perms_type, sort_no, always_show, icon,
  is_route, is_leaf, keep_alive, hidden, hide_tab, description,
  create_by, create_time, update_by, update_time, del_flag, rule_flag, status, internal_or_external
) VALUES (
  'ARCHIVE_MENU_DETAIL_0001', 'ARCHIVE_MENU_ROOT_0001', '档案账号详情', '/archive/account/detail', 'archive/ArchiveAccountDetail', NULL, NULL,
  1, 'archive:account:detail', '1', 3.00, 0, NULL,
  1, 1, 0, 1, 0, NULL,
  'admin', NOW(), NULL, NULL, 0, 0, '1', 0
);

COMMIT;
