From 5e662e59093760c487086c58b0dc6a4ea05a6f81 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Mon, 1 Apr 2019 14:44:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9BUG=EF=BC=9ASQLServer=20?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E5=90=8E=E5=8F=B0=E9=A1=B5=E9=9D=A2=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=89=93=E5=BC=80=20closed=20#IUW7V?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #Issue https://gitee.com/LongbowEnterprise/dashboard/issues?id=IUW7V #Comment DBCC CHECKIDENT(Navigations, RESEED, 0) 语句导致主键ID为0,层次菜单方法进入死循环 --- DatabaseScripts/InitData.sql | 28 ++++-------- DatabaseScripts/MySQL/initData.sql | 61 ++++++++++++------------- DatabaseScripts/Postgresql/initData.sql | 16 +++---- DatabaseScripts/SQLite/InitData.sql | 16 +++---- 4 files changed, 53 insertions(+), 68 deletions(-) diff --git a/DatabaseScripts/InitData.sql b/DatabaseScripts/InitData.sql index ac27591c..836f9c2d 100644 --- a/DatabaseScripts/InitData.sql +++ b/DatabaseScripts/InitData.sql @@ -7,7 +7,7 @@ SET IDENTITY_INSERT [dbo].[Users] ON insert into Users (ID, UserName, Password, PassSalt, DisplayName, RegisterTime, ApprovedTime,ApprovedBy, [Description]) values (1, 'Admin', 'Es7WVgNsJuELwWK8daCqufUBknCsSC0IYDphQZAiGOo=', 'W5vpBEOYRGHkQXatN0t+ECM/U8cHDuEgrq56+zZBk4J481xH', 'Administrator', GetDate(), GetDate(), 'system', N'系统默认创建') SET IDENTITY_INSERT [dbo].[Users] OFF -DELETE From Dicts +DELETE From Dicts Where Define = 0 INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'菜单', N'系统菜单', N'0', 0) INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'菜单', N'外部菜单', N'1', 0) INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'应用程序', N'未设置', N'0', 0) @@ -45,8 +45,7 @@ INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设 INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设置', N'JuheIPSvr', 'http://apis.juhe.cn/ip/ipNew?key=f57102d1b9fadd3f4a1c29072d0c0206&ip=', 0) INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设置', N'演示系统', '0', 0) -DELETE FROM Navigations -DBCC CHECKIDENT(Navigations, RESEED, 0) +DELETE FROM Navigations Where Category = N'0' INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, N'后台管理', 10, N'fa fa-gear', N'~/Admin/Index', N'0') INSERT [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, N'个人中心', 20, N'fa fa-suitcase', N'~/Admin/Profiles', N'0') INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (@@Identity, N'保存显示名称', 10, 'fa fa-fa', 'saveDisplayName', '0', 2); @@ -117,26 +116,17 @@ INSERT [dbo].[Roles] ([ID], [RoleName], [Description]) VALUES (1, N'Administrato INSERT [dbo].[Roles] ([ID], [RoleName], [Description]) VALUES (2, N'Default', N'默认用户,可访问前台页面') SET IDENTITY_INSERT [dbo].[Roles] OFF -DELETE FROM RoleGroup +DELETE FROM RoleGroup Where RoleID = 1 INSERT [dbo].[RoleGroup] ([RoleID], [GroupID]) VALUES (1, 1) -DELETE FROM UserGroup +DELETE FROM UserGroup Where UserID = 1 INSERT [dbo].[UserGroup] ([UserID], [GroupID]) VALUES (1, 1) -DELETE FROM UserRole +DELETE FROM UserRole Where UserID = 1 INSERT [dbo].[UserRole] ([UserID], [RoleID]) VALUES (1, 1) INSERT [dbo].[UserRole] ([UserID], [RoleID]) VALUES (1, 2) DELETE FROM NavigationRole -INSERT INTO NavigationRole SELECT id, 1 FROM navigations -INSERT [dbo].[NavigationRole] ([NavigationID], [RoleID]) VALUES (1, 2) -INSERT [dbo].[NavigationRole] ([NavigationID], [RoleID]) VALUES (2, 2) -INSERT [dbo].[NavigationRole] ([NavigationID], [RoleID]) VALUES (3, 2) -INSERT [dbo].[NavigationRole] ([NavigationID], [RoleID]) VALUES (10, 2) -INSERT [dbo].[NavigationRole] ([NavigationID], [RoleID]) VALUES (16, 2) -INSERT [dbo].[NavigationRole] ([NavigationID], [RoleID]) VALUES (17, 2) -INSERT [dbo].[NavigationRole] ([NavigationID], [RoleID]) VALUES (18, 2) -INSERT [dbo].[NavigationRole] ([NavigationID], [RoleID]) VALUES (19, 2) -- Client Data Declare @AppId nvarchar(1) @@ -156,12 +146,10 @@ Insert Dicts (Category, Name, Code, Define) values (@AppName, N'系统设置地 -- 菜单 DELETE FROM Navigations Where [Application] = @AppId -SET IDENTITY_INSERT [dbo].[Navigations] ON -INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category], [Application]) VALUES (210, 0, N'首页', 10, N'fa fa-fa', N'~/Home/Index', N'1', @AppId) +INSERT [dbo].[Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], [Application]) VALUES (0, N'首页', 10, N'fa fa-fa', N'~/Home/Index', N'1', @AppId) -INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category], [Application]) VALUES (220, 0, N'测试页面', 10, N'fa fa-fa', N'~/Home/Index', N'1', @AppId) -INSERT [dbo].[Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category], [Application]) VALUES (230, 220, N'关于', 10, N'fa fa-fa', N'~/Home/Index', N'1', @AppId) -SET IDENTITY_INSERT [dbo].[Navigations] OFF +INSERT [dbo].[Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], [Application]) VALUES (0, N'测试页面', 10, N'fa fa-fa', N'~/Home/Index', N'1', @AppId) +INSERT [dbo].[Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], [Application]) VALUES (@@Identity, N'关于', 10, N'fa fa-fa', N'~/Home/Index', N'1', @AppId) -- 菜单授权 DELETE FROM NavigationRole Where NavigationID in (Select ID From Navigations Where [Application] = @AppId) diff --git a/DatabaseScripts/MySQL/initData.sql b/DatabaseScripts/MySQL/initData.sql index fd7b41a6..e4ba462a 100644 --- a/DatabaseScripts/MySQL/initData.sql +++ b/DatabaseScripts/MySQL/initData.sql @@ -4,29 +4,29 @@ ALTER TABLE Users MODIFY COLUMN ID INT NOT NULL; INSERT INTO Users (ID, UserName, Password, PassSalt, DisplayName, RegisterTime, ApprovedTime,ApprovedBy, Description) values (1, 'Admin', 'Es7WVgNsJuELwWK8daCqufUBknCsSC0IYDphQZAiGOo=', 'W5vpBEOYRGHkQXatN0t+ECM/U8cHDuEgrq56+zZBk4J481xH', 'Administrator', now(), now(), 'system', '系统默认创建'); ALTER TABLE Users MODIFY COLUMN ID INT NOT NULL AUTO_INCREMENT; -DELETE From Dicts; -INSERT INTO Dicts (ID, Category, Name, Code, Define) VALUES (NULL, '菜单', '系统菜单', '0', 0); -INSERT INTO Dicts (ID, Category, Name, Code, Define) VALUES (NULL, '菜单', '外部菜单', '1', 0); -INSERT INTO Dicts (ID, Category, Name, Code, Define) VALUES (NULL, '应用程序', '未设置', '0', 0); -INSERT INTO Dicts (ID, Category, Name, Code, Define) VALUES (NULL, '网站设置', '网站标题', '后台管理系统', 0); -INSERT INTO Dicts (ID, Category, Name, Code, Define) VALUES (NULL, '网站设置', '网站页脚', '2016 © 通用后台管理系统', 0); -INSERT INTO Dicts (ID, Category, Name, Code, Define) VALUES (NULL, '系统通知', '用户注册', '0', 0); -INSERT INTO Dicts (ID, Category, Name, Code, Define) VALUES (NULL, '系统通知', '程序异常', '1', 0); -INSERT INTO Dicts (ID, Category, Name, Code, Define) VALUES (NULL, '系统通知', '数据库连接', '2', 0); -INSERT INTO Dicts (ID, Category, Name, Code, Define) VALUES (NULL, '通知状态', '未处理', '0', 0); -INSERT INTO Dicts (ID, Category, Name, Code, Define) VALUES (NULL, '通知状态', '已处理', '1', 0); -INSERT INTO Dicts (ID, Category, Name, Code, Define) VALUES (NULL, '处理结果', '同意', '0', 0); -INSERT INTO Dicts (ID, Category, Name, Code, Define) VALUES (NULL, '处理结果', '拒绝', '1', 0); -INSERT INTO Dicts (ID, Category, Name, Code, Define) VALUES (NULL, '消息状态', '未读', '0', 0); -INSERT INTO Dicts (ID, Category, Name, Code, Define) VALUES (NULL, '消息状态', '已读', '1', 0); -INSERT INTO Dicts (ID, Category, Name, Code, Define) VALUES (NULL, '消息标签', '一般', '0', 0); -INSERT INTO Dicts (ID, Category, Name, Code, Define) VALUES (NULL, '消息标签', '紧要', '1', 0); -INSERT INTO Dicts (ID, Category, Name, Code, Define) VALUES (NULL, '头像地址', '头像路径', '~/images/uploader/', 0); -INSERT INTO Dicts (ID, Category, Name, Code, Define) VALUES (NULL, '头像地址', '头像文件', 'default.jpg', 0); -INSERT INTO Dicts (ID, Category, Name, Code, Define) VALUES (NULL, '网站样式', '蓝色样式', 'blue.css', 0); -INSERT INTO Dicts (ID, Category, Name, Code, Define) VALUES (NULL, '网站样式', '黑色样式', 'black.css', 0); -INSERT INTO Dicts (ID, Category, Name, Code, Define) VALUES (NULL, '当前样式', '使用样式', 'blue.css', 0); -INSERT INTO Dicts (ID, Category, Name, Code, Define) VALUES (NULL, '网站设置', '前台首页', '~/Home/Index', 0); +DELETE From Dicts Where Define = 0; +INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('菜单', '系统菜单', '0', 0); +INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('菜单', '外部菜单', '1', 0); +INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('应用程序', '未设置', '0', 0); +INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('网站设置', '网站标题', '后台管理系统', 0); +INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('网站设置', '网站页脚', '2016 © 通用后台管理系统', 0); +INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统通知', '用户注册', '0', 0); +INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统通知', '程序异常', '1', 0); +INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统通知', '数据库连接', '2', 0); +INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('通知状态', '未处理', '0', 0); +INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('通知状态', '已处理', '1', 0); +INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('处理结果', '同意', '0', 0); +INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('处理结果', '拒绝', '1', 0); +INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('消息状态', '未读', '0', 0); +INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('消息状态', '已读', '1', 0); +INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('消息标签', '一般', '0', 0); +INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('消息标签', '紧要', '1', 0); +INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('头像地址', '头像路径', '~/images/uploader/', 0); +INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('头像地址', '头像文件', 'default.jpg', 0); +INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('网站样式', '蓝色样式', 'blue.css', 0); +INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('网站样式', '黑色样式', 'black.css', 0); +INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('当前样式', '使用样式', 'blue.css', 0); +INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('网站设置', '前台首页', '~/Home/Index', 0); -- 时长单位 月 INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', '程序异常保留时长', '1', 0); @@ -42,8 +42,7 @@ INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'BaiDuI INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'JuheIPSvr', 'http://apis.juhe.cn/ip/ipNew?key=f57102d1b9fadd3f4a1c29072d0c0206&ip=', 0); INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', '演示系统', '0', 0); -DELETE FROM Navigations; -Truncate Navigations; +DELETE FROM Navigations Where Category = '0'; INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (0, '后台管理', 10, 'fa fa-gear', '~/Admin/Index', '0'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category) VALUES (0, '个人中心', 20, 'fa fa-suitcase', '~/Admin/Profiles', '0'); INSERT INTO Navigations (ParentId, Name, `Order`, Icon, Url, Category, IsResource) VALUES (@@identity, '保存显示名称', 10, 'fa fa-fa', 'saveDisplayName', '0', 2); @@ -114,13 +113,13 @@ INSERT INTO Roles (ID, RoleName, Description) VALUES (1, 'Administrators', '系 INSERT INTO Roles (ID, RoleName, Description) VALUES (2, 'Default', '默认用户,可访问前台页面'); ALTER TABLE Roles MODIFY COLUMN ID INT NOT NULL AUTO_INCREMENT; -DELETE FROM RoleGroup; +DELETE FROM RoleGroup Where RoleID = 1; INSERT INTO RoleGroup (RoleID, GroupID) VALUES (1, 1); -DELETE FROM UserGroup; +DELETE FROM UserGroup Where UserID = 1; INSERT INTO UserGroup (UserID, GroupID) VALUES (1, 1); -DELETE FROM UserRole; +DELETE FROM UserRole Where UserID = 1; INSERT INTO UserRole (UserID, RoleID) VALUES (1, 1); INSERT INTO UserRole (UserID, RoleID) VALUES (1, 2); @@ -138,10 +137,10 @@ Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '个人 Insert into Dicts (Category, Name, Code, Define) values ('测试平台', '系统设置地址', 'http://localhost:50852/Admin/Index', 1); Delete from Navigations where Application = 2; -INSERT into Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category, Application) VALUES (NULL, 0, '首页', 10, 'fa fa-fa', '~/Home/Index', '1', 2); +INSERT into Navigations (ParentId, Name, `Order`, Icon, Url, Category, Application) VALUES (0, '首页', 10, 'fa fa-fa', '~/Home/Index', '1', 2); -INSERT into Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category, Application) VALUES (NULL, 0, '测试页面', 20, 'fa fa-fa', '#', '1', 2); -INSERT into Navigations (ID, ParentId, Name, `Order`, Icon, Url, Category, Application) VALUES (NULL, @@identity, '关于', 10, 'fa fa-fa', '~/Home/About', '1', 2); +INSERT into Navigations (ParentId, Name, `Order`, Icon, Url, Category, Application) VALUES (0, '测试页面', 20, 'fa fa-fa', '#', '1', 2); +INSERT into Navigations (ParentId, Name, `Order`, Icon, Url, Category, Application) VALUES (@@identity, '关于', 10, 'fa fa-fa', '~/Home/About', '1', 2); -- 菜单授权 DELETE FROM NavigationRole Where NavigationID in (Select ID From Navigations Where Application = 2); diff --git a/DatabaseScripts/Postgresql/initData.sql b/DatabaseScripts/Postgresql/initData.sql index de69b56d..e82d2ca7 100644 --- a/DatabaseScripts/Postgresql/initData.sql +++ b/DatabaseScripts/Postgresql/initData.sql @@ -3,8 +3,7 @@ DELETE From Users; ALTER SEQUENCE users_id_seq RESTART WITH 1; INSERT INTO Users (UserName, Password, PassSalt, DisplayName, RegisterTime, ApprovedTime,ApprovedBy, Description) values ('Admin', 'Es7WVgNsJuELwWK8daCqufUBknCsSC0IYDphQZAiGOo=', 'W5vpBEOYRGHkQXatN0t+ECM/U8cHDuEgrq56+zZBk4J481xH', 'Administrator', now(), now(), 'system', '系统默认创建'); -DELETE From Dicts; -ALTER SEQUENCE dicts_id_seq RESTART WITH 1; +DELETE From Dicts Where Define = 0; INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('菜单', '系统菜单', '0', 0); INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('菜单', '外部菜单', '1', 0); INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('应用程序', '未设置', '0', 0); @@ -42,8 +41,7 @@ INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'BaiDuI INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'JuheIPSvr', 'http://apis.juhe.cn/ip/ipNew?key=f57102d1b9fadd3f4a1c29072d0c0206&ip=', 0); INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', '演示系统', '0', 0); -DELETE FROM Navigations; -ALTER SEQUENCE navigations_id_seq RESTART WITH 1; +DELETE FROM Navigations Where Category = '0'; INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '后台管理', 10, 'fa fa-gear', '~/Admin/Index', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (0, '个人中心', 20, 'fa fa-suitcase', '~/Admin/Profiles', '0'); INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (currval('navigations_id_seq') - 1, '保存显示名称', 10, 'fa fa-fa', 'saveDisplayName', '0', 2); @@ -103,22 +101,22 @@ INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (c INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (currval('navigations_id_seq') - 2, 'API文档', 10, 'fa fa-wrench', '~/swagger', '0'); INSERT INTO Navigations (ParentId, Name, "order", Icon, Url, Category) VALUES (currval('navigations_id_seq') - 3, '图标集', 10, 'fa fa-dashboard', '~/Admin/FAIcon', '0'); -DELETE FROM Groups; +DELETE FROM Groups Where ID = 1; ALTER SEQUENCE groups_id_seq RESTART WITH 1; INSERT INTO Groups (ID, GroupName, Description) VALUES (1, 'Admin', '系统默认组'); -DELETE FROM Roles; +DELETE FROM Roles Where ID in (1, 2); ALTER SEQUENCE roles_id_seq RESTART WITH 1; INSERT INTO Roles (RoleName, Description) VALUES ('Administrators', '系统管理员'); INSERT INTO Roles (RoleName, Description) VALUES ('Default', '默认用户,可访问前台页面'); -DELETE FROM RoleGroup; +DELETE FROM RoleGroup Where RoleID = 1; INSERT INTO RoleGroup (RoleID, GroupID) VALUES (1, 1); -DELETE FROM UserGroup; +DELETE FROM UserGroup Where UserID = 1; INSERT INTO UserGroup (UserID, GroupID) VALUES (1, 1); -DELETE FROM UserRole; +DELETE FROM UserRole Where UserID = 1; INSERT INTO UserRole (UserID, RoleID) VALUES (1, 1); INSERT INTO UserRole (UserID, RoleID) VALUES (1, 2); diff --git a/DatabaseScripts/SQLite/InitData.sql b/DatabaseScripts/SQLite/InitData.sql index 05b86073..d05ec895 100644 --- a/DatabaseScripts/SQLite/InitData.sql +++ b/DatabaseScripts/SQLite/InitData.sql @@ -2,7 +2,7 @@ DELETE From Users where ID = 1; -- ADMIN/123789 INSERT INTO Users (ID, UserName, [Password], PassSalt, DisplayName, RegisterTime, ApprovedTime,ApprovedBy, [Description]) values (1, 'Admin', 'Es7WVgNsJuELwWK8daCqufUBknCsSC0IYDphQZAiGOo=', 'W5vpBEOYRGHkQXatN0t+ECM/U8cHDuEgrq56+zZBk4J481xH', 'Administrator', datetime(CURRENT_TIMESTAMP, 'localtime'), datetime(CURRENT_TIMESTAMP, 'localtime'), 'system', '系统默认创建'); -DELETE From Dicts; +DELETE From Dicts Where Define = 0; INSERT INTO [Dicts] ([ID], [Category], [Name], [Code], [Define]) VALUES (NULL, '菜单', '系统菜单', '0', 0); INSERT INTO [Dicts] ([ID], [Category], [Name], [Code], [Define]) VALUES (NULL, '菜单', '外部菜单', '1', 0); INSERT INTO [Dicts] ([ID], [Category], [Name], [Code], [Define]) VALUES (NULL, '应用程序', '未设置', '0', 0); @@ -40,7 +40,7 @@ INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统设置 INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统设置', 'JuheIPSvr', 'http://apis.juhe.cn/ip/ipNew?key=f57102d1b9fadd3f4a1c29072d0c0206&ip=', 0); INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统设置', '演示系统', '0', 0); -DELETE FROM Navigations; +DELETE FROM Navigations Where Category = '0'; INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '后台管理', 10, 'fa fa-gear', '~/Admin/Index', '0'); INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category]) VALUES (0, '个人中心', 20, 'fa fa-suitcase', '~/Admin/Profiles', '0'); INSERT INTO [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], IsResource) VALUES (last_insert_rowid(), '保存显示名称', 10, 'fa fa-fa', 'saveDisplayName', '0', 2); @@ -107,13 +107,13 @@ DELETE FROM Roles where ID in (1, 2); INSERT INTO [Roles] ([ID], [RoleName], [Description]) VALUES (1, 'Administrators', '系统管理员'); INSERT INTO [Roles] ([ID], [RoleName], [Description]) VALUES (2, 'Default', '默认用户,可访问前台页面'); -DELETE FROM RoleGroup; +DELETE FROM RoleGroup Where RoleID = 1; INSERT INTO [RoleGroup] ([RoleID], [GroupID]) VALUES (1, 1); -DELETE FROM UserGroup; +DELETE FROM UserGroup Where UserID = 1; INSERT INTO [UserGroup] ([UserID], [GroupID]) VALUES (1, 1); -DELETE FROM UserRole; +DELETE FROM UserRole Where UserID = 1; INSERT INTO [UserRole] ([UserID], [RoleID]) VALUES (1, 1); INSERT INTO [UserRole] ([UserID], [RoleID]) VALUES (1, 2); @@ -131,10 +131,10 @@ Insert into Dicts (Category, [Name], Code, Define) values ('测试平台', '个 Insert into Dicts (Category, [Name], Code, Define) values ('测试平台', '系统设置地址', 'http://localhost:50852/Admin/Index', 1); Delete from [Navigations] where Application = 2; -INSERT into [Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category], [Application]) VALUES (NULL, 0, '首页', 10, 'fa fa-fa', '~/Home/Index', '1', 2); +INSERT into [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], [Application]) VALUES (0, '首页', 10, 'fa fa-fa', '~/Home/Index', '1', 2); -INSERT into [Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category], [Application]) VALUES (NULL, 0, '测试页面', 20, 'fa fa-fa', '#', '1', 2); -INSERT into [Navigations] ([ID], [ParentId], [Name], [Order], [Icon], [Url], [Category], [Application]) VALUES (NULL, last_insert_rowid(), '关于', 10, 'fa fa-fa', '~/Home/About', '1', 2); +INSERT into [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], [Application]) VALUES (0, '测试页面', 20, 'fa fa-fa', '#', '1', 2); +INSERT into [Navigations] ([ParentId], [Name], [Order], [Icon], [Url], [Category], [Application]) VALUES (last_insert_rowid(), '关于', 10, 'fa fa-fa', '~/Home/About', '1', 2); -- 菜单授权 DELETE FROM NavigationRole Where NavigationID in (Select ID From Navigations Where [Application] = 2);