chore: 增加 Models 工程
This commit is contained in:
parent
33ed7abc0d
commit
16d3d52005
|
@ -2,7 +2,8 @@
|
||||||
"solution": {
|
"solution": {
|
||||||
"path": "BootstrapAdmin.sln",
|
"path": "BootstrapAdmin.sln",
|
||||||
"projects": [
|
"projects": [
|
||||||
"..\\BootstrapBlazor\\src\\BootstrapBlazor\\BootstrapBlazor.csproj",
|
"src\\blazor\\admin\\BootstrapAdmin.DataAccess.EFCore\\BootstrapAdmin.DataAccess.EFCore.csproj",
|
||||||
|
"src\\blazor\\admin\\BootstrapAdmin.DataAccess.Models\\BootstrapAdmin.DataAccess.Models.csproj",
|
||||||
"src\\blazor\\admin\\BootstrapAdmin.DataAccess\\BootstrapAdmin.DataAccess.csproj",
|
"src\\blazor\\admin\\BootstrapAdmin.DataAccess\\BootstrapAdmin.DataAccess.csproj",
|
||||||
"src\\blazor\\admin\\BootstrapAdmin.Web\\BootstrapAdmin.Web.csproj",
|
"src\\blazor\\admin\\BootstrapAdmin.Web\\BootstrapAdmin.Web.csproj",
|
||||||
"src\\mvc\\admin\\Bootstrap.Admin\\Bootstrap.Admin.csproj",
|
"src\\mvc\\admin\\Bootstrap.Admin\\Bootstrap.Admin.csproj",
|
||||||
|
|
|
@ -147,6 +147,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BootstrapAdmin.Web", "src\b
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BootstrapAdmin.DataAccess", "src\blazor\admin\BootstrapAdmin.DataAccess\BootstrapAdmin.DataAccess.csproj", "{1C04A3C2-DF68-4716-BA69-259CEC6E2311}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BootstrapAdmin.DataAccess", "src\blazor\admin\BootstrapAdmin.DataAccess\BootstrapAdmin.DataAccess.csproj", "{1C04A3C2-DF68-4716-BA69-259CEC6E2311}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BootstrapAdmin.DataAccess.EFCore", "src\blazor\admin\BootstrapAdmin.DataAccess.EFCore\BootstrapAdmin.DataAccess.EFCore.csproj", "{D8ED2DF7-F7E1-4DE7-B097-D0BEE51D58E9}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BootstrapAdmin.DataAccess.Models", "src\blazor\admin\BootstrapAdmin.DataAccess.Models\BootstrapAdmin.DataAccess.Models.csproj", "{7E3861AB-F797-4A9F-B7CE-0E35751FFCD9}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
@ -197,6 +201,14 @@ Global
|
||||||
{1C04A3C2-DF68-4716-BA69-259CEC6E2311}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{1C04A3C2-DF68-4716-BA69-259CEC6E2311}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{1C04A3C2-DF68-4716-BA69-259CEC6E2311}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{1C04A3C2-DF68-4716-BA69-259CEC6E2311}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{1C04A3C2-DF68-4716-BA69-259CEC6E2311}.Release|Any CPU.Build.0 = Release|Any CPU
|
{1C04A3C2-DF68-4716-BA69-259CEC6E2311}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{D8ED2DF7-F7E1-4DE7-B097-D0BEE51D58E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{D8ED2DF7-F7E1-4DE7-B097-D0BEE51D58E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{D8ED2DF7-F7E1-4DE7-B097-D0BEE51D58E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{D8ED2DF7-F7E1-4DE7-B097-D0BEE51D58E9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{7E3861AB-F797-4A9F-B7CE-0E35751FFCD9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{7E3861AB-F797-4A9F-B7CE-0E35751FFCD9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{7E3861AB-F797-4A9F-B7CE-0E35751FFCD9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{7E3861AB-F797-4A9F-B7CE-0E35751FFCD9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -230,6 +242,8 @@ Global
|
||||||
{55A2459A-6BDE-4493-B2C0-5BE1673E99EE} = {DAE3826B-AAAB-468A-9A06-2F56EF5C0767}
|
{55A2459A-6BDE-4493-B2C0-5BE1673E99EE} = {DAE3826B-AAAB-468A-9A06-2F56EF5C0767}
|
||||||
{EF5EF5A4-616A-4BA7-9E1E-1407E8EC0395} = {45ADEF9B-C8BD-4224-9E12-F6716E85A22C}
|
{EF5EF5A4-616A-4BA7-9E1E-1407E8EC0395} = {45ADEF9B-C8BD-4224-9E12-F6716E85A22C}
|
||||||
{1C04A3C2-DF68-4716-BA69-259CEC6E2311} = {45ADEF9B-C8BD-4224-9E12-F6716E85A22C}
|
{1C04A3C2-DF68-4716-BA69-259CEC6E2311} = {45ADEF9B-C8BD-4224-9E12-F6716E85A22C}
|
||||||
|
{D8ED2DF7-F7E1-4DE7-B097-D0BEE51D58E9} = {45ADEF9B-C8BD-4224-9E12-F6716E85A22C}
|
||||||
|
{7E3861AB-F797-4A9F-B7CE-0E35751FFCD9} = {45ADEF9B-C8BD-4224-9E12-F6716E85A22C}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {221EAE38-5F75-4391-9A48-E462A9F3B8FC}
|
SolutionGuid = {221EAE38-5F75-4391-9A48-E462A9F3B8FC}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
|
@ -0,0 +1,7 @@
|
||||||
|
namespace BootstrapAdmin.DataAccess.EFCore
|
||||||
|
{
|
||||||
|
public class Class1
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
|
@ -0,0 +1,113 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<doc>
|
||||||
|
<assembly>
|
||||||
|
<name>BootstrapAdmin.DataAccess.Models</name>
|
||||||
|
</assembly>
|
||||||
|
<members>
|
||||||
|
<member name="T:BootstrapAdmin.DataAccess.Models.Dicts">
|
||||||
|
<summary>
|
||||||
|
字典配置项
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:BootstrapAdmin.DataAccess.Models.Dicts.Id">
|
||||||
|
<summary>
|
||||||
|
获得/设置 字典主键 数据库自增列
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:BootstrapAdmin.DataAccess.Models.Dicts.Category">
|
||||||
|
<summary>
|
||||||
|
获得/设置 字典分类
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:BootstrapAdmin.DataAccess.Models.Dicts.Name">
|
||||||
|
<summary>
|
||||||
|
获得/设置 字典名称
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:BootstrapAdmin.DataAccess.Models.Dicts.Code">
|
||||||
|
<summary>
|
||||||
|
获得/设置 字典字典值
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:BootstrapAdmin.DataAccess.Models.Dicts.Define">
|
||||||
|
<summary>
|
||||||
|
获得/设置 字典定义值 0 表示系统使用,1 表示用户自定义 默认为 1
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:BootstrapAdmin.DataAccess.Models.Navigations">
|
||||||
|
<summary>
|
||||||
|
Bootstrap Admin 后台管理菜单相关操作实体类
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:BootstrapAdmin.DataAccess.Models.Navigations.Id">
|
||||||
|
<summary>
|
||||||
|
获得/设置 菜单主键ID
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:BootstrapAdmin.DataAccess.Models.Navigations.ParentId">
|
||||||
|
<summary>
|
||||||
|
获得/设置 父级菜单ID 默认为 0
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:BootstrapAdmin.DataAccess.Models.Navigations.ParentName">
|
||||||
|
<summary>
|
||||||
|
获得/设置 父级菜单名称
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:BootstrapAdmin.DataAccess.Models.Navigations.Name">
|
||||||
|
<summary>
|
||||||
|
获得/设置 菜单名称
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:BootstrapAdmin.DataAccess.Models.Navigations.Order">
|
||||||
|
<summary>
|
||||||
|
获得/设置 菜单序号
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:BootstrapAdmin.DataAccess.Models.Navigations.Icon">
|
||||||
|
<summary>
|
||||||
|
获得/设置 菜单图标
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:BootstrapAdmin.DataAccess.Models.Navigations.Url">
|
||||||
|
<summary>
|
||||||
|
获得/设置 菜单URL地址
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:BootstrapAdmin.DataAccess.Models.Navigations.Category">
|
||||||
|
<summary>
|
||||||
|
获得/设置 菜单分类, 0 表示系统菜单 1 表示用户自定义菜单
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:BootstrapAdmin.DataAccess.Models.Navigations.CategoryName">
|
||||||
|
<summary>
|
||||||
|
获得 菜单分类名称,取字典表中的Name category="菜单"
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:BootstrapAdmin.DataAccess.Models.Navigations.Active">
|
||||||
|
<summary>
|
||||||
|
获得/设置 是否当前被选中 active为选中
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:BootstrapAdmin.DataAccess.Models.Navigations.Target">
|
||||||
|
<summary>
|
||||||
|
获得/设置 链接目标
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:BootstrapAdmin.DataAccess.Models.Navigations.IsResource">
|
||||||
|
<summary>
|
||||||
|
获得/设置 是否为资源文件, 0 表示菜单 1 表示资源 2 表示按钮
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:BootstrapAdmin.DataAccess.Models.Navigations.Application">
|
||||||
|
<summary>
|
||||||
|
获得/设置 所属应用程序,此属性由BA后台字典表分配
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="P:BootstrapAdmin.DataAccess.Models.Navigations.Menus">
|
||||||
|
<summary>
|
||||||
|
获得/设置 当前菜单项的所有子菜单集合
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
</members>
|
||||||
|
</doc>
|
|
@ -1,14 +1,11 @@
|
||||||
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
|
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
|
||||||
|
|
||||||
using PetaPoco;
|
|
||||||
|
|
||||||
namespace BootstrapAdmin.DataAccess.Models
|
namespace BootstrapAdmin.DataAccess.Models
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 字典配置项
|
/// 字典配置项
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[TableName("Dicts")]
|
public class Dicts
|
||||||
public class Dict
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获得/设置 字典主键 数据库自增列
|
/// 获得/设置 字典主键 数据库自增列
|
|
@ -1,14 +1,11 @@
|
||||||
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
|
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
|
||||||
|
|
||||||
using PetaPoco;
|
|
||||||
|
|
||||||
namespace BootstrapAdmin.DataAccess.Models
|
namespace BootstrapAdmin.DataAccess.Models
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bootstrap Admin 后台管理菜单相关操作实体类
|
/// Bootstrap Admin 后台管理菜单相关操作实体类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[TableName("Navigations")]
|
public class Navigations
|
||||||
public class Menu
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获得/设置 菜单主键ID
|
/// 获得/设置 菜单主键ID
|
||||||
|
@ -78,6 +75,6 @@ namespace BootstrapAdmin.DataAccess.Models
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获得/设置 当前菜单项的所有子菜单集合
|
/// 获得/设置 当前菜单项的所有子菜单集合
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<Menu> Menus { get; } = new List<Menu>();
|
public List<Navigations> Menus { get; } = new List<Navigations>();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,154 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
<doc>
|
|
||||||
<assembly>
|
|
||||||
<name>Admin.DataAccess</name>
|
|
||||||
</assembly>
|
|
||||||
<members>
|
|
||||||
<member name="T:Microsoft.Extensions.DependencyInjection.ServicesExtensions">
|
|
||||||
<summary>
|
|
||||||
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="M:Microsoft.Extensions.DependencyInjection.ServicesExtensions.AddDataAccessServices(Microsoft.Extensions.DependencyInjection.IServiceCollection)">
|
|
||||||
<summary>
|
|
||||||
|
|
||||||
</summary>
|
|
||||||
<param name="services"></param>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="T:Admin.DataAccess.Models.Dict">
|
|
||||||
<summary>
|
|
||||||
字典配置项
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Admin.DataAccess.Models.Dict.Id">
|
|
||||||
<summary>
|
|
||||||
获得/设置 字典主键 数据库自增列
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Admin.DataAccess.Models.Dict.Category">
|
|
||||||
<summary>
|
|
||||||
获得/设置 字典分类
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Admin.DataAccess.Models.Dict.Name">
|
|
||||||
<summary>
|
|
||||||
获得/设置 字典名称
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Admin.DataAccess.Models.Dict.Code">
|
|
||||||
<summary>
|
|
||||||
获得/设置 字典字典值
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Admin.DataAccess.Models.Dict.Define">
|
|
||||||
<summary>
|
|
||||||
获得/设置 字典定义值 0 表示系统使用,1 表示用户自定义 默认为 1
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="T:Admin.DataAccess.Models.Menu">
|
|
||||||
<summary>
|
|
||||||
Bootstrap Admin 后台管理菜单相关操作实体类
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Admin.DataAccess.Models.Menu.Id">
|
|
||||||
<summary>
|
|
||||||
获得/设置 菜单主键ID
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Admin.DataAccess.Models.Menu.ParentId">
|
|
||||||
<summary>
|
|
||||||
获得/设置 父级菜单ID 默认为 0
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Admin.DataAccess.Models.Menu.ParentName">
|
|
||||||
<summary>
|
|
||||||
获得/设置 父级菜单名称
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Admin.DataAccess.Models.Menu.Name">
|
|
||||||
<summary>
|
|
||||||
获得/设置 菜单名称
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Admin.DataAccess.Models.Menu.Order">
|
|
||||||
<summary>
|
|
||||||
获得/设置 菜单序号
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Admin.DataAccess.Models.Menu.Icon">
|
|
||||||
<summary>
|
|
||||||
获得/设置 菜单图标
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Admin.DataAccess.Models.Menu.Url">
|
|
||||||
<summary>
|
|
||||||
获得/设置 菜单URL地址
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Admin.DataAccess.Models.Menu.Category">
|
|
||||||
<summary>
|
|
||||||
获得/设置 菜单分类, 0 表示系统菜单 1 表示用户自定义菜单
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Admin.DataAccess.Models.Menu.CategoryName">
|
|
||||||
<summary>
|
|
||||||
获得 菜单分类名称,取字典表中的Name category="菜单"
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Admin.DataAccess.Models.Menu.Active">
|
|
||||||
<summary>
|
|
||||||
获得/设置 是否当前被选中 active为选中
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Admin.DataAccess.Models.Menu.Target">
|
|
||||||
<summary>
|
|
||||||
获得/设置 链接目标
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Admin.DataAccess.Models.Menu.IsResource">
|
|
||||||
<summary>
|
|
||||||
获得/设置 是否为资源文件, 0 表示菜单 1 表示资源 2 表示按钮
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Admin.DataAccess.Models.Menu.Application">
|
|
||||||
<summary>
|
|
||||||
获得/设置 所属应用程序,此属性由BA后台字典表分配
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:Admin.DataAccess.Models.Menu.Menus">
|
|
||||||
<summary>
|
|
||||||
获得/设置 当前菜单项的所有子菜单集合
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="T:Admin.DataAccess.Services.IMenu">
|
|
||||||
<summary>
|
|
||||||
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="M:Admin.DataAccess.Services.IMenu.GetMenus">
|
|
||||||
<summary>
|
|
||||||
|
|
||||||
</summary>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="T:Admin.DataAccess.Services.MenuService">
|
|
||||||
<summary>
|
|
||||||
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="M:Admin.DataAccess.Services.MenuService.#ctor(PetaPoco.IDatabase)">
|
|
||||||
<summary>
|
|
||||||
|
|
||||||
</summary>
|
|
||||||
<param name="db"></param>
|
|
||||||
</member>
|
|
||||||
<member name="M:Admin.DataAccess.Services.MenuService.GetMenus">
|
|
||||||
<summary>
|
|
||||||
|
|
||||||
</summary>
|
|
||||||
<returns></returns>
|
|
||||||
<exception cref="T:System.NotImplementedException"></exception>
|
|
||||||
</member>
|
|
||||||
</members>
|
|
||||||
</doc>
|
|
|
@ -7,15 +7,17 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="BootstrapBlazor" Version="6.1.1-beta01" />
|
|
||||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Data.Sqlite" Version="6.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
|
||||||
<PackageReference Include="PetaPoco.Extensions" Version="5.2.0" />
|
<PackageReference Include="PetaPoco.Extensions" Version="5.2.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Using Include="BootstrapBlazor.Components" />
|
<ProjectReference Include="..\BootstrapAdmin.DataAccess.Models\BootstrapAdmin.DataAccess.Models.csproj" />
|
||||||
<Using Include="Microsoft.AspNetCore.Components" />
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
<Using Include="System.Diagnostics.CodeAnalysis" />
|
<Using Include="System.Diagnostics.CodeAnalysis" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
@ -4,165 +4,6 @@
|
||||||
<name>BootstrapAdmin.DataAccess</name>
|
<name>BootstrapAdmin.DataAccess</name>
|
||||||
</assembly>
|
</assembly>
|
||||||
<members>
|
<members>
|
||||||
<member name="T:BootstrapAdmin.DataAccess.Extensions.MenuItemExtensions">
|
|
||||||
<summary>
|
|
||||||
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="M:BootstrapAdmin.DataAccess.Extensions.MenuItemExtensions.Parse(BootstrapAdmin.DataAccess.Models.Menu)">
|
|
||||||
<summary>
|
|
||||||
|
|
||||||
</summary>
|
|
||||||
<param name="menu"></param>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="T:BootstrapAdmin.DataAccess.Models.Dict">
|
|
||||||
<summary>
|
|
||||||
字典配置项
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:BootstrapAdmin.DataAccess.Models.Dict.Id">
|
|
||||||
<summary>
|
|
||||||
获得/设置 字典主键 数据库自增列
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:BootstrapAdmin.DataAccess.Models.Dict.Category">
|
|
||||||
<summary>
|
|
||||||
获得/设置 字典分类
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:BootstrapAdmin.DataAccess.Models.Dict.Name">
|
|
||||||
<summary>
|
|
||||||
获得/设置 字典名称
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:BootstrapAdmin.DataAccess.Models.Dict.Code">
|
|
||||||
<summary>
|
|
||||||
获得/设置 字典字典值
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:BootstrapAdmin.DataAccess.Models.Dict.Define">
|
|
||||||
<summary>
|
|
||||||
获得/设置 字典定义值 0 表示系统使用,1 表示用户自定义 默认为 1
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="T:BootstrapAdmin.DataAccess.Models.Menu">
|
|
||||||
<summary>
|
|
||||||
Bootstrap Admin 后台管理菜单相关操作实体类
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:BootstrapAdmin.DataAccess.Models.Menu.Id">
|
|
||||||
<summary>
|
|
||||||
获得/设置 菜单主键ID
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:BootstrapAdmin.DataAccess.Models.Menu.ParentId">
|
|
||||||
<summary>
|
|
||||||
获得/设置 父级菜单ID 默认为 0
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:BootstrapAdmin.DataAccess.Models.Menu.ParentName">
|
|
||||||
<summary>
|
|
||||||
获得/设置 父级菜单名称
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:BootstrapAdmin.DataAccess.Models.Menu.Name">
|
|
||||||
<summary>
|
|
||||||
获得/设置 菜单名称
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:BootstrapAdmin.DataAccess.Models.Menu.Order">
|
|
||||||
<summary>
|
|
||||||
获得/设置 菜单序号
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:BootstrapAdmin.DataAccess.Models.Menu.Icon">
|
|
||||||
<summary>
|
|
||||||
获得/设置 菜单图标
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:BootstrapAdmin.DataAccess.Models.Menu.Url">
|
|
||||||
<summary>
|
|
||||||
获得/设置 菜单URL地址
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:BootstrapAdmin.DataAccess.Models.Menu.Category">
|
|
||||||
<summary>
|
|
||||||
获得/设置 菜单分类, 0 表示系统菜单 1 表示用户自定义菜单
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:BootstrapAdmin.DataAccess.Models.Menu.CategoryName">
|
|
||||||
<summary>
|
|
||||||
获得 菜单分类名称,取字典表中的Name category="菜单"
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:BootstrapAdmin.DataAccess.Models.Menu.Active">
|
|
||||||
<summary>
|
|
||||||
获得/设置 是否当前被选中 active为选中
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:BootstrapAdmin.DataAccess.Models.Menu.Target">
|
|
||||||
<summary>
|
|
||||||
获得/设置 链接目标
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:BootstrapAdmin.DataAccess.Models.Menu.IsResource">
|
|
||||||
<summary>
|
|
||||||
获得/设置 是否为资源文件, 0 表示菜单 1 表示资源 2 表示按钮
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:BootstrapAdmin.DataAccess.Models.Menu.Application">
|
|
||||||
<summary>
|
|
||||||
获得/设置 所属应用程序,此属性由BA后台字典表分配
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="P:BootstrapAdmin.DataAccess.Models.Menu.Menus">
|
|
||||||
<summary>
|
|
||||||
获得/设置 当前菜单项的所有子菜单集合
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="T:BootstrapAdmin.DataAccess.Services.IMenu">
|
|
||||||
<summary>
|
|
||||||
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="M:BootstrapAdmin.DataAccess.Services.IMenu.GetAdminMenusByUser(System.String)">
|
|
||||||
<summary>
|
|
||||||
|
|
||||||
</summary>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="T:BootstrapAdmin.DataAccess.Services.MenuService">
|
|
||||||
<summary>
|
|
||||||
|
|
||||||
</summary>
|
|
||||||
</member>
|
|
||||||
<member name="M:BootstrapAdmin.DataAccess.Services.MenuService.#ctor(PetaPoco.IDatabase)">
|
|
||||||
<summary>
|
|
||||||
|
|
||||||
</summary>
|
|
||||||
<param name="db"></param>
|
|
||||||
</member>
|
|
||||||
<member name="M:BootstrapAdmin.DataAccess.Services.MenuService.GetAdminMenusByUser(System.String)">
|
|
||||||
<summary>
|
|
||||||
|
|
||||||
</summary>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:BootstrapAdmin.DataAccess.Services.MenuService.CascadeMenus(System.Collections.Generic.IEnumerable{BootstrapAdmin.DataAccess.Models.Menu})">
|
|
||||||
<summary>
|
|
||||||
获得带层次关系的菜单集合
|
|
||||||
</summary>
|
|
||||||
<param name="menus">未层次化菜单集合</param>
|
|
||||||
<returns>带层次化的菜单集合</returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:BootstrapAdmin.DataAccess.Services.MenuService.RetrieveAllMenus(System.String)">
|
|
||||||
<summary>
|
|
||||||
获得指定用户名可访问的所有菜单集合
|
|
||||||
</summary>
|
|
||||||
<param name="userName">当前用户名</param>
|
|
||||||
<returns>未层次化的菜单集合</returns>
|
|
||||||
</member>
|
|
||||||
<member name="T:Microsoft.Extensions.DependencyInjection.ServicesExtensions">
|
<member name="T:Microsoft.Extensions.DependencyInjection.ServicesExtensions">
|
||||||
<summary>
|
<summary>
|
||||||
|
|
||||||
|
@ -175,5 +16,39 @@
|
||||||
<param name="services"></param>
|
<param name="services"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:BootstrapAdmin.DataAccess.Services.IDicts">
|
||||||
|
<summary>
|
||||||
|
Dict 字典表接口
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="T:BootstrapAdmin.DataAccess.Services.INavigations">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:BootstrapAdmin.DataAccess.Services.INavigations.RetrieveAllMenus(System.String)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="T:BootstrapAdmin.DataAccess.Services.NavigationsService">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:BootstrapAdmin.DataAccess.Services.NavigationsService.#ctor(PetaPoco.IDatabase)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="db"></param>
|
||||||
|
</member>
|
||||||
|
<member name="M:BootstrapAdmin.DataAccess.Services.NavigationsService.RetrieveAllMenus(System.String)">
|
||||||
|
<summary>
|
||||||
|
获得指定用户名可访问的所有菜单集合
|
||||||
|
</summary>
|
||||||
|
<param name="userName">当前用户名</param>
|
||||||
|
<returns>未层次化的菜单集合</returns>
|
||||||
|
</member>
|
||||||
</members>
|
</members>
|
||||||
</doc>
|
</doc>
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
using Microsoft.AspNetCore.Components.Routing;
|
|
||||||
|
|
||||||
namespace BootstrapAdmin.DataAccess.Extensions
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public static class MenuItemExtensions
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="menu"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static MenuItem Parse(this Models.Menu menu) => new()
|
|
||||||
{
|
|
||||||
Text = menu.Name,
|
|
||||||
Url = menu.Url.Replace("~", ""),
|
|
||||||
Icon = menu.Icon,
|
|
||||||
Match = NavLinkMatch.All,
|
|
||||||
Target = menu.Target,
|
|
||||||
Id = menu.Id,
|
|
||||||
ParentId = menu.ParentId
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -26,8 +26,8 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||||
return new Database<SQLiteDatabaseProvider>(connString);
|
return new Database<SQLiteDatabaseProvider>(connString);
|
||||||
});
|
});
|
||||||
|
|
||||||
services.TryAddSingleton<IMenu, MenuService>();
|
services.TryAddSingleton<INavigations, NavigationsService>();
|
||||||
services.TryAddSingleton<IDict, DictService>();
|
services.TryAddSingleton<IDicts, DictsService>();
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace BootstrapAdmin.DataAccess.Services
|
namespace BootstrapAdmin.DataAccess.Services
|
||||||
{
|
{
|
||||||
class DictService : IDict
|
class DictsService : IDicts
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,15 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace BootstrapAdmin.DataAccess.Services
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Dict 字典表接口
|
|
||||||
/// </summary>
|
|
||||||
public interface IDict
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
namespace BootstrapAdmin.DataAccess.Services
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Dict 字典表接口
|
||||||
|
/// </summary>
|
||||||
|
public interface IDicts
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,12 +5,12 @@ namespace BootstrapAdmin.DataAccess.Services
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IMenu
|
public interface INavigations
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
IEnumerable<MenuItem> GetAdminMenusByUser(string userName);
|
List<Navigations> RetrieveAllMenus(string userName);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,64 +0,0 @@
|
||||||
using BootstrapAdmin.DataAccess.Extensions;
|
|
||||||
using PetaPoco;
|
|
||||||
|
|
||||||
namespace BootstrapAdmin.DataAccess.Services
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
class MenuService : IMenu
|
|
||||||
{
|
|
||||||
private IDatabase _db;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="db"></param>
|
|
||||||
public MenuService(IDatabase db) => _db = db;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public IEnumerable<MenuItem> GetAdminMenusByUser(string userName)
|
|
||||||
{
|
|
||||||
var menus = RetrieveAllMenus(userName).Where(m => m.Category == "0" && m.IsResource == 0);
|
|
||||||
return CascadeMenus(menus);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获得带层次关系的菜单集合
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="menus">未层次化菜单集合</param>
|
|
||||||
/// <returns>带层次化的菜单集合</returns>
|
|
||||||
public static IEnumerable<MenuItem> CascadeMenus(IEnumerable<Models.Menu> menus)
|
|
||||||
{
|
|
||||||
var root = menus.Where(m => m.ParentId == "0")
|
|
||||||
.OrderBy(m => m.Category).ThenBy(m => m.Application).ThenBy(m => m.Order)
|
|
||||||
.Select(m => m.Parse())
|
|
||||||
.ToList();
|
|
||||||
CascadeMenus(menus, root);
|
|
||||||
return root;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void CascadeMenus(IEnumerable<Models.Menu> navs, List<MenuItem> level)
|
|
||||||
{
|
|
||||||
level.ForEach(m =>
|
|
||||||
{
|
|
||||||
m.Items = navs.Where(sub => sub.ParentId == m.Id).OrderBy(sub => sub.Order).Select(sub => sub.Parse()).ToList();
|
|
||||||
CascadeMenus(navs, m.Items.ToList());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获得指定用户名可访问的所有菜单集合
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="userName">当前用户名</param>
|
|
||||||
/// <returns>未层次化的菜单集合</returns>
|
|
||||||
private List<Models.Menu> RetrieveAllMenus(string userName)
|
|
||||||
{
|
|
||||||
var order = _db.Provider.EscapeSqlIdentifier("Order");
|
|
||||||
return _db.Fetch<Models.Menu>($"select n.ID, n.ParentId, n.Name, n.{order}, n.Icon, n.Url, n.Category, n.Target, n.IsResource, n.Application, d.Name as CategoryName, ln.Name as ParentName from Navigations n inner join Dicts d on n.Category = d.Code and d.Category = @Category and d.Define = 0 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", new { UserName = userName, Category = "菜单", RoleName = "Administrators" });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
using BootstrapAdmin.DataAccess.Models;
|
||||||
|
using PetaPoco;
|
||||||
|
|
||||||
|
namespace BootstrapAdmin.DataAccess.Services
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
class NavigationsService : INavigations
|
||||||
|
{
|
||||||
|
private IDatabase _db;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="db"></param>
|
||||||
|
public NavigationsService(IDatabase db) => _db = db;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获得指定用户名可访问的所有菜单集合
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userName">当前用户名</param>
|
||||||
|
/// <returns>未层次化的菜单集合</returns>
|
||||||
|
public List<Navigations> RetrieveAllMenus(string userName)
|
||||||
|
{
|
||||||
|
var order = _db.Provider.EscapeSqlIdentifier("Order");
|
||||||
|
return _db.Fetch<Models.Navigations>($"select n.ID, n.ParentId, n.Name, n.{order}, n.Icon, n.Url, n.Category, n.Target, n.IsResource, n.Application, d.Name as CategoryName, ln.Name as ParentName from Navigations n inner join Dicts d on n.Category = d.Code and d.Category = @Category and d.Define = 0 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", new { UserName = userName, Category = "菜单", RoleName = "Administrators" });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,6 +5,10 @@
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="BootstrapBlazor" Version="6.1.1-beta01" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\BootstrapAdmin.DataAccess\BootstrapAdmin.DataAccess.csproj" />
|
<ProjectReference Include="..\BootstrapAdmin.DataAccess\BootstrapAdmin.DataAccess.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -83,6 +83,31 @@
|
||||||
<typeparam name="TModel"></typeparam>
|
<typeparam name="TModel"></typeparam>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:BootstrapAdmin.Web.Extensions.MenuExtensions">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:BootstrapAdmin.Web.Extensions.MenuExtensions.Parse(BootstrapAdmin.DataAccess.Models.Navigations)">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<param name="menu"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:BootstrapAdmin.Web.Extensions.MenuExtensions.ToAdminMenus(System.Collections.Generic.List{BootstrapAdmin.DataAccess.Models.Navigations})">
|
||||||
|
<summary>
|
||||||
|
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
|
<member name="M:BootstrapAdmin.Web.Extensions.MenuExtensions.CascadeMenus(System.Collections.Generic.IEnumerable{BootstrapAdmin.DataAccess.Models.Navigations})">
|
||||||
|
<summary>
|
||||||
|
获得带层次关系的菜单集合
|
||||||
|
</summary>
|
||||||
|
<param name="navigations">未层次化菜单集合</param>
|
||||||
|
<returns>带层次化的菜单集合</returns>
|
||||||
|
</member>
|
||||||
<member name="T:BootstrapAdmin.Web.Models.DictsSearchModel">
|
<member name="T:BootstrapAdmin.Web.Models.DictsSearchModel">
|
||||||
<summary>
|
<summary>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
using BootstrapAdmin.DataAccess.Models;
|
||||||
|
using Microsoft.AspNetCore.Components.Routing;
|
||||||
|
|
||||||
|
namespace BootstrapAdmin.Web.Extensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public static class MenuExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="menu"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static MenuItem Parse(this DataAccess.Models.Navigations menu) => new()
|
||||||
|
{
|
||||||
|
Text = menu.Name,
|
||||||
|
Url = menu.Url.Replace("~", ""),
|
||||||
|
Icon = menu.Icon,
|
||||||
|
Match = NavLinkMatch.All,
|
||||||
|
Target = menu.Target,
|
||||||
|
Id = menu.Id,
|
||||||
|
ParentId = menu.ParentId
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static IEnumerable<MenuItem> ToAdminMenus(this List<Navigations> navigations)
|
||||||
|
{
|
||||||
|
var menus = navigations.Where(m => m.Category == "0" && m.IsResource == 0);
|
||||||
|
return CascadeMenus(menus);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获得带层次关系的菜单集合
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="navigations">未层次化菜单集合</param>
|
||||||
|
/// <returns>带层次化的菜单集合</returns>
|
||||||
|
public static IEnumerable<MenuItem> CascadeMenus(IEnumerable<Navigations> navigations)
|
||||||
|
{
|
||||||
|
var root = navigations.Where(m => m.ParentId == "0")
|
||||||
|
.OrderBy(m => m.Category).ThenBy(m => m.Application).ThenBy(m => m.Order)
|
||||||
|
.Select(m => m.Parse())
|
||||||
|
.ToList();
|
||||||
|
CascadeMenus(navigations, root);
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void CascadeMenus(IEnumerable<Navigations> navigations, List<MenuItem> level)
|
||||||
|
{
|
||||||
|
level.ForEach(m =>
|
||||||
|
{
|
||||||
|
m.Items = navigations.Where(sub => sub.ParentId == m.Id).OrderBy(sub => sub.Order).Select(sub => sub.Parse()).ToList();
|
||||||
|
CascadeMenus(navigations, m.Items.ToList());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -32,17 +32,17 @@ namespace BootstrapAdmin.Web.Models
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Name))
|
if (!string.IsNullOrEmpty(Name))
|
||||||
{
|
{
|
||||||
ret.Add(new SearchFilterAction(nameof(Dict.Name), Name));
|
ret.Add(new SearchFilterAction(nameof(Dicts.Name), Name));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Category))
|
if (!string.IsNullOrEmpty(Category))
|
||||||
{
|
{
|
||||||
ret.Add(new SearchFilterAction(nameof(Dict.Category), Category));
|
ret.Add(new SearchFilterAction(nameof(Dicts.Category), Category));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Define.HasValue)
|
if (Define.HasValue)
|
||||||
{
|
{
|
||||||
ret.Add(new SearchFilterAction(nameof(Dict.Define), Define, FilterAction.Equal));
|
ret.Add(new SearchFilterAction(nameof(Dicts.Define), Define, FilterAction.Equal));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
@page "/Admin/Dicts"
|
@page "/Admin/Dicts"
|
||||||
|
|
||||||
<BlazorTable TItem="Dict" IsPagination="false" TableSearchModel="DictsSearchModel">
|
<BlazorTable TItem="DataAccess.Models.Dicts" IsPagination="false" TableSearchModel="DictsSearchModel">
|
||||||
<ColumnsTemplete>
|
<ColumnsTemplete>
|
||||||
<TableColumn @bind-Field="context.Category" Text="字典标签" Filterable="true" Searchable="true" Sortable="true"></TableColumn>
|
<TableColumn @bind-Field="context.Category" Text="字典标签" Filterable="true" Searchable="true" Sortable="true"></TableColumn>
|
||||||
<TableColumn @bind-Field="context.Name" Text="字典名称" Filterable="true" Searchable="true" Sortable="true"></TableColumn>
|
<TableColumn @bind-Field="context.Name" Text="字典名称" Filterable="true" Searchable="true" Sortable="true"></TableColumn>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using BootstrapAdmin.DataAccess.Services;
|
using BootstrapAdmin.DataAccess.Services;
|
||||||
|
using BootstrapAdmin.Web.Extensions;
|
||||||
|
|
||||||
namespace BootstrapAdmin.Web.Shared
|
namespace BootstrapAdmin.Web.Shared
|
||||||
{
|
{
|
||||||
|
@ -11,7 +12,7 @@ namespace BootstrapAdmin.Web.Shared
|
||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
[NotNull]
|
[NotNull]
|
||||||
private IMenu? MenuService { get; set; }
|
private INavigations? NavigationsService { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
@ -20,7 +21,7 @@ namespace BootstrapAdmin.Web.Shared
|
||||||
{
|
{
|
||||||
base.OnInitialized();
|
base.OnInitialized();
|
||||||
|
|
||||||
MenuItems = MenuService.GetAdminMenusByUser("Admin");
|
MenuItems = NavigationsService.RetrieveAllMenus("Admin").ToAdminMenus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue