diff --git a/db/SQLite/InitData.sql b/db/SQLite/InitData.sql
index 803188fd..45c39201 100644
--- a/db/SQLite/InitData.sql
+++ b/db/SQLite/InitData.sql
@@ -5,8 +5,6 @@ INSERT INTO Users (UserName, Password, PassSalt, DisplayName, RegisterTime, Appr
INSERT INTO Users (UserName, Password, PassSalt, DisplayName, RegisterTime, ApprovedTime, ApprovedBy, [Description], [App]) values ('User', 'tXG/yNffpnm6cThrCH7wf6jN1ic3VHvLoY4OrzKtrZ4=', 'c5cIrRMn8XjB84M/D/X7Lg9uUqQFmYNEdxb/4HWH8OLa4pNZ', '测试账号', datetime(CURRENT_TIMESTAMP, 'localtime'), datetime(CURRENT_TIMESTAMP, 'localtime'), 'system', '系统默认创建', 'Demo');
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 ('应用程序', '后台管理', 'BA', 0);
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('网站设置', '网站标题', '后台管理系统', 0);
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('网站设置', '网站页脚', '2016 © 通用后台管理系统', 0);
diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/EnumNavigationCategory.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/EnumNavigationCategory.cs
index 68ed3f36..06763f6c 100644
--- a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/EnumNavigationCategory.cs
+++ b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/EnumNavigationCategory.cs
@@ -10,12 +10,12 @@ public enum EnumNavigationCategory
///
/// 系统使用
///
- [Description("系统使用")]
+ [Description("后台菜单")]
System,
///
/// 用户自定义
///
- [Description("自定义")]
+ [Description("前台菜单")]
Customer
}
diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.PetaPoco/Services/NavigationService.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.PetaPoco/Services/NavigationService.cs
index 2653328f..b4f70a84 100644
--- a/src/blazor/admin/BootstrapAdmin.DataAccess.PetaPoco/Services/NavigationService.cs
+++ b/src/blazor/admin/BootstrapAdmin.DataAccess.PetaPoco/Services/NavigationService.cs
@@ -29,7 +29,7 @@ class NavigationService : INavigation
return CacheManager.GetOrAdd($"{nameof(NavigationService)}-{nameof(GetAllMenus)}-{userName}", entry =>
{
var order = Database.Provider.EscapeSqlIdentifier("Order");
- return Database.Fetch($"select n.ID, n.ParentId, n.Name, n.{order}, n.Icon, n.Url, n.Category, n.Target, n.IsResource, n.Application, ln.Name as ParentName from Navigations n inner join Dicts d on n.Category = d.Code and d.Category = @Category and d.Define = @Define left join Navigations ln on n.ParentId = ln.ID inner join (select nr.NavigationID from Users u inner join UserRole ur on ur.UserID = u.ID inner join NavigationRole nr on nr.RoleID = ur.RoleID where u.UserName = @UserName union select nr.NavigationID from Users u inner join UserGroup ug on u.ID = ug.UserID inner join RoleGroup rg on rg.GroupID = ug.GroupID inner join NavigationRole nr on nr.RoleID = rg.RoleID where u.UserName = @UserName union select n.ID from Navigations n where EXISTS (select UserName from Users u inner join UserRole ur on u.ID = ur.UserID inner join Roles r on ur.RoleID = r.ID where u.UserName = @UserName and r.RoleName = @RoleName)) nav on n.ID = nav.NavigationID ORDER BY n.Application, n.{order}", new { UserName = userName, Category = "菜单", RoleName = "Administrators", Define = EnumDictDefine.System });
+ return Database.Fetch($"select n.ID, n.ParentId, n.Name, n.{order}, n.Icon, n.Url, n.Category, n.Target, n.IsResource, n.Application from Navigations n inner join (select nr.NavigationID from Users u inner join UserRole ur on ur.UserID = u.ID inner join NavigationRole nr on nr.RoleID = ur.RoleID where u.UserName = @UserName union select nr.NavigationID from Users u inner join UserGroup ug on u.ID = ug.UserID inner join RoleGroup rg on rg.GroupID = ug.GroupID inner join NavigationRole nr on nr.RoleID = rg.RoleID where u.UserName = @UserName union select n.ID from Navigations n where EXISTS (select UserName from Users u inner join UserRole ur on u.ID = ur.UserID inner join Roles r on ur.RoleID = r.ID where u.UserName = @UserName and r.RoleName = @RoleName)) nav on n.ID = nav.NavigationID ORDER BY n.Application, n.{order}", new { UserName = userName, RoleName = "Administrators" });
});
}
diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.PetaPoco/Services/UserService.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.PetaPoco/Services/UserService.cs
index 73478ec1..c4be47a4 100644
--- a/src/blazor/admin/BootstrapAdmin.DataAccess.PetaPoco/Services/UserService.cs
+++ b/src/blazor/admin/BootstrapAdmin.DataAccess.PetaPoco/Services/UserService.cs
@@ -68,7 +68,7 @@ class UserService : IUser
///
///
///
- public List GetRoles(string userName) => Database.Fetch($"select r.RoleName from Roles r inner join UserRole ur on r.ID=ur.RoleID inner join Users u on ur.UserID = u.ID and u.UserName = @0 union select r.RoleName from Roles r inner join RoleGroup rg on r.ID = rg.RoleID inner join {Database.Provider.EscapeSqlIdentifier("Groups")} g on rg.GroupID = g.ID inner join UserGroup ug on ug.GroupID = g.ID inner join Users u on ug.UserID = u.ID and u.UserName=@0", userName);
+ public List GetRoles(string userName) => Database.Fetch($"select r.RoleName from Roles r inner join UserRole ur on r.ID=ur.RoleID inner join Users u on ur.UserID = u.ID and u.UserName = @0 union select r.RoleName from Roles r inner join RoleGroup rg on r.ID = rg.RoleID inner join {Database.Provider.EscapeSqlIdentifier("Groups")} g on rg.GroupID = g.ID inner join UserGroup ug on ug.GroupID = g.ID inner join Users u on ug.UserID = u.ID and u.UserName = @0", userName);
///
///
diff --git a/src/blazor/admin/BootstrapAdmin.Web/BootstrapAdmin.db b/src/blazor/admin/BootstrapAdmin.Web/BootstrapAdmin.db
index 079d3c5b..040ea33c 100644
Binary files a/src/blazor/admin/BootstrapAdmin.Web/BootstrapAdmin.db and b/src/blazor/admin/BootstrapAdmin.Web/BootstrapAdmin.db differ
diff --git a/src/blazor/admin/BootstrapAdmin.Web/Extensions/MenuExtensions.cs b/src/blazor/admin/BootstrapAdmin.Web/Extensions/MenuExtensions.cs
index ec9f96c0..cde686e9 100644
--- a/src/blazor/admin/BootstrapAdmin.Web/Extensions/MenuExtensions.cs
+++ b/src/blazor/admin/BootstrapAdmin.Web/Extensions/MenuExtensions.cs
@@ -16,7 +16,7 @@ namespace BootstrapAdmin.Web.Extensions
public static MenuItem Parse(this DataAccess.Models.Navigation menu) => new()
{
Text = menu.Name,
- Url = menu.Url.Replace("~", ""),
+ Url = menu.Url.Replace("~/", "/"),
Icon = menu.Icon,
Match = NavLinkMatch.All,
Target = menu.Target,
@@ -24,21 +24,11 @@ namespace BootstrapAdmin.Web.Extensions
ParentId = menu.ParentId
};
- ///
- /// 获取前台菜单
- ///
- ///
- public static IEnumerable