-- -- 添加一个账号 -- INSERT INTO sys_users (id, username, password, name, state, user_type, created_at, updated_at) -- SELECT 1, 'admin', 'bWlyZW5kZW1pYW5iYW9uYenypblyMogTK3fAPeP3HTk=', '迷人的面包呐', 1, 1, '2024-09-13 15:33:03', '2024-09-13 07:43:14' -- WHERE NOT EXISTS (SELECT id FROM sys_users LIMIT 1); -- -- 添加基础路由 -- INSERT INTO sys_menus (`id`, `menu_id`, `name`, `url`, `perms`, `type`, `path`, `refresh`, `icon`, `sort_number`, `created_at`, `updated_at`) -- SELECT 1, NULL, '系统', NULL, 'system', '1', 'system', "0", 'menu-gongju', 1, '2024-09-13 08:18:42', '2024-09-13 08:36:18' -- WHERE NOT EXISTS (SELECT 1 FROM sys_menus WHERE id = 1); -- INSERT INTO sys_menus (`id`, `menu_id`, `name`, `url`, `perms`, `type`, `path`, `refresh`, `icon`, `sort_number`, `created_at`, `updated_at`) -- SELECT 2, 1, '菜单管理', 'views/system/menu/index.vue', 'system-menu', '2', 'system-menu', '', "0", 1, '2024-09-13 08:20:44', '2024-09-13 08:33:53' -- WHERE NOT EXISTS (SELECT 1 FROM sys_menus WHERE id = 2); -- INSERT INTO sys_menus (`id`, `menu_id`, `name`, `url`, `perms`, `type`, `path`, `refresh`, `icon`, `sort_number`, `created_at`, `updated_at`) -- SELECT 3, 1, '员工账号', 'views/system/user/index.vue', NULL, '2', 'system-user', "0", NULL, 2, '2024-09-13 08:44:15', '2024-09-13 08:44:15' -- WHERE NOT EXISTS (SELECT 1 FROM sys_menus WHERE id = 3); -- INSERT INTO sys_menus (`id`, `menu_id`, `name`, `url`, `perms`, `type`, `path`, `refresh`, `icon`, `sort_number`, `created_at`, `updated_at`) -- SELECT 4, 1, '角色权限', 'views/system/role/index.vue', NULL, '2', 'system-role', "0", NULL, 3, '2024-09-13 08:45:03', '2024-09-13 08:45:03' -- WHERE NOT EXISTS (SELECT 1 FROM sys_menus WHERE id = 4); -- -- 添加一个角色 -- INSERT INTO role (id, name, description, created_at, updated_at) -- SELECT 1, '管理员', '平台管理员', '2024-09-13 15:57:44', '2024-09-13 15:57:47' -- WHERE NOT EXISTS (SELECT id FROM role LIMIT 1); -- 添加初始化角色和账号关系 -- INSERT INTO sys_user_roles (`id`, `user_id`, `role_id`, `created_at`, `updated_at`) -- SELECT 1, 1, 1, '2024-09-13 16:15:41', '2024-09-13 08:15:44' -- WHERE NOT EXISTS (SELECT id FROM sys_user_roles LIMIT 1); -- 添加角色与菜单绑定 -- INSERT INTO sys_role_menus (`id`, `role_id`, `menu_id`, `created_at`, `updated_at`) -- SELECT 1, 1, 1, '2024-09-13 08:47:55', '2024-09-13 08:47:55' -- WHERE NOT EXISTS (SELECT id FROM sys_role_menus LIMIT 1); -- INSERT INTO sys_role_menus (`id`, `role_id`, `menu_id`, `created_at`, `updated_at`) -- SELECT 2, 1, 2, '2024-09-13 08:47:55', '2024-09-13 08:47:55' -- WHERE NOT EXISTS (SELECT 1 FROM sys_role_menus WHERE id = 2); -- INSERT INTO sys_role_menus (`id`, `role_id`, `menu_id`, `created_at`, `updated_at`) -- SELECT 3, 1, 3, '2024-09-13 08:47:55', '2024-09-13 08:47:55' -- WHERE NOT EXISTS (SELECT 1 FROM sys_role_menus WHERE id = 3); -- INSERT INTO sys_role_menus (`id`, `role_id`, `menu_id`, `created_at`, `updated_at`) -- SELECT 4, 1, 4, '2024-09-13 08:47:55', '2024-09-13 08:47:55' -- WHERE NOT EXISTS (SELECT 1 FROM sys_role_menus WHERE id = 4);