diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.EFCore/BootstrapAdminContext.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.EFCore/BootstrapAdminContext.cs
index 3d27df21..7ba57af4 100644
--- a/src/blazor/admin/BootstrapAdmin.DataAccess.EFCore/BootstrapAdminContext.cs
+++ b/src/blazor/admin/BootstrapAdmin.DataAccess.EFCore/BootstrapAdminContext.cs
@@ -1,50 +1,49 @@
using BootstrapAdmin.DataAccess.Models;
using Microsoft.EntityFrameworkCore;
-namespace BootstrapAdmin.DataAccess.EFCore
+namespace BootstrapAdmin.DataAccess.EFCore;
+
+///
+///
+///
+public class BootstrapAdminContext : DbContext
{
+ ///
+ /// 构造函数
+ ///
+ ///
+ public BootstrapAdminContext(DbContextOptions options) : base(options)
+ {
+
+ }
+
///
///
///
- public class BootstrapAdminContext : DbContext
+ [NotNull]
+ public DbSet? Dicts { get; set; }
+
+ ///
+ ///
+ ///
+ [NotNull]
+ public DbSet? Users { get; set; }
+
+ ///
+ ///
+ ///
+ [NotNull]
+ public DbSet? Navigations { get; set; }
+
+ ///
+ ///
+ ///
+ ///
+ protected override void OnModelCreating(ModelBuilder modelBuilder)
{
- ///
- /// 构造函数
- ///
- ///
- public BootstrapAdminContext(DbContextOptions options) : base(options)
- {
-
- }
-
- ///
- ///
- ///
- [NotNull]
- public DbSet? Dicts { get; set; }
-
- ///
- ///
- ///
- [NotNull]
- public DbSet? Users { get; set; }
-
- ///
- ///
- ///
- [NotNull]
- public DbSet? Navigations { get; set; }
-
- ///
- ///
- ///
- ///
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- modelBuilder.Entity().Ignore(u => u.Period);
- modelBuilder.Entity().Ignore(u => u.NewPassword);
- modelBuilder.Entity().Ignore(u => u.CofirmPassword);
- modelBuilder.Entity().Ignore(u => u.IsReset);
- }
+ modelBuilder.Entity().Ignore(u => u.Period);
+ modelBuilder.Entity().Ignore(u => u.NewPassword);
+ modelBuilder.Entity().Ignore(u => u.CofirmPassword);
+ modelBuilder.Entity().Ignore(u => u.IsReset);
}
}
diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.EFCore/Extensions/ServicesExtensions.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.EFCore/Extensions/ServicesExtensions.cs
index 979d84ae..78439a7c 100644
--- a/src/blazor/admin/BootstrapAdmin.DataAccess.EFCore/Extensions/ServicesExtensions.cs
+++ b/src/blazor/admin/BootstrapAdmin.DataAccess.EFCore/Extensions/ServicesExtensions.cs
@@ -4,50 +4,49 @@ using BootstrapAdmin.Web.Core;
using BootstrapBlazor.Components;
using Microsoft.EntityFrameworkCore;
-namespace Microsoft.Extensions.DependencyInjection
+namespace Microsoft.Extensions.DependencyInjection;
+
+///
+///
+///
+public static class ServicesExtensions
{
///
///
///
- public static class ServicesExtensions
+ ///
+ ///
+ ///
+ ///
+ public static IServiceCollection AddEFCoreDataAccessServices(this IServiceCollection services, Action optionConfigure, ServiceLifetime lifetime = ServiceLifetime.Singleton)
{
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public static IServiceCollection AddEFCoreDataAccessServices(this IServiceCollection services, Action optionConfigure, ServiceLifetime lifetime = ServiceLifetime.Singleton)
- {
- services.AddDbContextFactory(optionConfigure, lifetime);
+ services.AddDbContextFactory(optionConfigure, lifetime);
- services.AddServices();
- return services;
- }
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public static IServiceCollection AddEFCoreDataAccessServices(this IServiceCollection services, Action optionConfigure, ServiceLifetime lifetime = ServiceLifetime.Singleton)
- {
- services.AddDbContextFactory(optionConfigure, lifetime);
+ services.AddServices();
+ return services;
+ }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static IServiceCollection AddEFCoreDataAccessServices(this IServiceCollection services, Action optionConfigure, ServiceLifetime lifetime = ServiceLifetime.Singleton)
+ {
+ services.AddDbContextFactory(optionConfigure, lifetime);
- services.AddServices();
- return services;
- }
+ services.AddServices();
+ return services;
+ }
- private static IServiceCollection AddServices(this IServiceCollection services)
- {
- // 增加数据服务
- services.AddSingleton(typeof(IDataService<>), typeof(DefaultDataService<>));
+ private static IServiceCollection AddServices(this IServiceCollection services)
+ {
+ // 增加数据服务
+ services.AddSingleton(typeof(IDataService<>), typeof(DefaultDataService<>));
- services.AddSingleton();
- services.AddSingleton();
- return services;
- }
+ services.AddSingleton();
+ services.AddSingleton();
+ return services;
}
}
diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.EFCore/Services/DefaultDataService.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.EFCore/Services/DefaultDataService.cs
index abf6c91b..b9ec6674 100644
--- a/src/blazor/admin/BootstrapAdmin.DataAccess.EFCore/Services/DefaultDataService.cs
+++ b/src/blazor/admin/BootstrapAdmin.DataAccess.EFCore/Services/DefaultDataService.cs
@@ -5,91 +5,90 @@
using BootstrapBlazor.Components;
using Microsoft.EntityFrameworkCore;
-namespace BootstrapAdmin.DataAccess.EFCore.Services
+namespace BootstrapAdmin.DataAccess.EFCore.Services;
+
+///
+/// EFCore ORM 的 IDataService 接口实现
+///
+class DefaultDataService : DataServiceBase where TModel : class, new()
{
+ private IDbContextFactory DbFactory { get; }
+
///
- /// EFCore ORM 的 IDataService 接口实现
+ /// 构造函数
///
- class DefaultDataService : DataServiceBase where TModel : class, new()
+ public DefaultDataService(IDbContextFactory factory) => DbFactory = factory;
+
+ ///
+ /// 删除方法
+ ///
+ ///
+ ///
+ public override async Task DeleteAsync(IEnumerable models)
{
- private IDbContextFactory DbFactory { get; }
+ // 通过模型获取主键列数据
+ // 支持批量删除
+ var context = DbFactory.CreateDbContext();
+ context.RemoveRange(models);
+ return await context.SaveChangesAsync() > 0;
+ }
- ///
- /// 构造函数
- ///
- public DefaultDataService(IDbContextFactory factory) => DbFactory = factory;
-
- ///
- /// 删除方法
- ///
- ///
- ///
- public override async Task DeleteAsync(IEnumerable models)
+ ///
+ /// 保存方法
+ ///
+ ///
+ ///
+ ///
+ public override async Task SaveAsync(TModel model, ItemChangedType changedType)
+ {
+ var context = DbFactory.CreateDbContext();
+ if (changedType == ItemChangedType.Add)
{
- // 通过模型获取主键列数据
- // 支持批量删除
- var context = DbFactory.CreateDbContext();
- context.RemoveRange(models);
- return await context.SaveChangesAsync() > 0;
+ context.Entry(model).State = EntityState.Added;
}
-
- ///
- /// 保存方法
- ///
- ///
- ///
- ///
- public override async Task SaveAsync(TModel model, ItemChangedType changedType)
+ else
{
- var context = DbFactory.CreateDbContext();
- if (changedType == ItemChangedType.Add)
- {
- context.Entry(model).State = EntityState.Added;
- }
- else
- {
- context.Entry(model).State = EntityState.Modified;
- }
- return await context.SaveChangesAsync() > 0;
+ context.Entry(model).State = EntityState.Modified;
}
+ return await context.SaveChangesAsync() > 0;
+ }
- ///
- /// 查询方法
- ///
- ///
- ///
- public override Task> QueryAsync(QueryPageOptions option)
+ ///
+ /// 查询方法
+ ///
+ ///
+ ///
+ public override Task> QueryAsync(QueryPageOptions option)
+ {
+ var context = DbFactory.CreateDbContext();
+ var ret = new QueryData()
{
- var context = DbFactory.CreateDbContext();
- var ret = new QueryData()
- {
- IsSorted = true,
- IsFiltered = true,
- IsSearch = true
- };
+ IsSorted = true,
+ IsFiltered = true,
+ IsSearch = true
+ };
- var filters = option.Filters.Concat(option.Searchs).Concat(option.CustomerSearchs);
- if (option.IsPage)
- {
- var items = context.Set()
- .Where(filters.GetFilterLambda(), filters.Any())
- .Sort(option.SortName!, option.SortOrder, !string.IsNullOrEmpty(option.SortName))
- .Count(out var count)
- .Page((option.PageIndex - 1) * option.PageItems, option.PageItems);
+ var filters = option.Filters.Concat(option.Searchs).Concat(option.CustomerSearchs);
+ if (option.IsPage)
+ {
+ var items = context.Set()
+ .Where(filters.GetFilterLambda(), filters.Any())
+ .Sort(option.SortName!, option.SortOrder, !string.IsNullOrEmpty(option.SortName))
+ .Count(out var count)
+ .Page((option.PageIndex - 1) * option.PageItems, option.PageItems);
- ret.TotalCount = count;
- ret.Items = items;
- }
- else
- {
- var items = context.Set()
- .Where(filters.GetFilterLambda(), filters.Any())
- .Sort(option.SortName!, option.SortOrder, !string.IsNullOrEmpty(option.SortName))
- .Count(out var count);
- ret.TotalCount = count;
- ret.Items = items;
- }
- return Task.FromResult(ret);
+ ret.TotalCount = count;
+ ret.Items = items;
}
+ else
+ {
+ var items = context.Set()
+ .Where(filters.GetFilterLambda(), filters.Any())
+ .Sort(option.SortName!, option.SortOrder, !string.IsNullOrEmpty(option.SortName))
+ .Count(out var count);
+ ret.TotalCount = count;
+ ret.Items = items;
+ }
+ return Task.FromResult(ret);
}
}
diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.EFCore/Services/DictService.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.EFCore/Services/DictService.cs
index 11bc893b..f578b6d6 100644
--- a/src/blazor/admin/BootstrapAdmin.DataAccess.EFCore/Services/DictService.cs
+++ b/src/blazor/admin/BootstrapAdmin.DataAccess.EFCore/Services/DictService.cs
@@ -2,53 +2,52 @@
using BootstrapAdmin.Web.Core;
using BootstrapBlazor.Components;
-namespace BootstrapAdmin.DataAccess.EFCore.Services
+namespace BootstrapAdmin.DataAccess.EFCore.Services;
+
+class DictService : IDict
{
- class DictService : IDict
+ public Dictionary GetApps()
{
- public Dictionary GetApps()
- {
- throw new NotImplementedException();
- }
+ throw new NotImplementedException();
+ }
- public Dictionary GetLogins()
- {
- throw new NotImplementedException();
- }
+ public Dictionary GetLogins()
+ {
+ throw new NotImplementedException();
+ }
- public Dictionary GetThemes()
- {
- throw new NotImplementedException();
- }
+ public Dictionary GetThemes()
+ {
+ throw new NotImplementedException();
+ }
- public string GetWebFooter()
- {
- throw new NotImplementedException();
- }
+ public string GetWebFooter()
+ {
+ throw new NotImplementedException();
+ }
- public string GetWebTitle()
- {
- throw new NotImplementedException();
- }
+ public string GetWebTitle()
+ {
+ throw new NotImplementedException();
+ }
- public bool IsDemo()
- {
- throw new NotImplementedException();
- }
+ public bool IsDemo()
+ {
+ throw new NotImplementedException();
+ }
- public bool SaveDemo(bool isDemo)
- {
- throw new NotImplementedException();
- }
+ public bool SaveDemo(bool isDemo)
+ {
+ throw new NotImplementedException();
+ }
- public bool AuthenticateDemo(string code)
- {
- throw new NotImplementedException();
- }
+ public bool AuthenticateDemo(string code)
+ {
+ throw new NotImplementedException();
+ }
- public bool SaveHealthCheck(bool enable = true)
- {
- throw new NotImplementedException();
- }
+ public bool SaveHealthCheck(bool enable = true)
+ {
+ throw new NotImplementedException();
}
}
diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.EFCore/Services/NavigationsService.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.EFCore/Services/NavigationsService.cs
index f34fd425..1e4b9903 100644
--- a/src/blazor/admin/BootstrapAdmin.DataAccess.EFCore/Services/NavigationsService.cs
+++ b/src/blazor/admin/BootstrapAdmin.DataAccess.EFCore/Services/NavigationsService.cs
@@ -2,41 +2,40 @@
using BootstrapAdmin.DataAccess.Models;
using Microsoft.EntityFrameworkCore;
-namespace BootstrapAdmin.DataAccess.EFCore.Services
+namespace BootstrapAdmin.DataAccess.EFCore.Services;
+
+///
+///
+///
+class NavigationsService : INavigation
{
+ private IDbContextFactory DbFactory { get; set; }
+
///
///
///
- class NavigationsService : INavigation
+ ///
+ public NavigationsService(IDbContextFactory factory) => DbFactory = factory;
+
+ ///
+ /// 获得指定用户名可访问的所有菜单集合
+ ///
+ /// 当前用户名
+ /// 未层次化的菜单集合
+ public List GetAllMenus(string userName)
{
- private IDbContextFactory DbFactory { get; set; }
+ using var context = DbFactory.CreateDbContext();
+ //return context..Fetch($"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" });
+ return new List();
+ }
- ///
- ///
- ///
- ///
- public NavigationsService(IDbContextFactory factory) => DbFactory = factory;
+ public List GetMenusByRoleId(string? roleId)
+ {
+ throw new NotImplementedException();
+ }
- ///
- /// 获得指定用户名可访问的所有菜单集合
- ///
- /// 当前用户名
- /// 未层次化的菜单集合
- public List GetAllMenus(string userName)
- {
- using var context = DbFactory.CreateDbContext();
- //return context..Fetch($"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" });
- return new List();
- }
-
- public List GetMenusByRoleId(string? roleId)
- {
- throw new NotImplementedException();
- }
-
- public bool SaveMenusByRoleId(string? roleId, List menuIds)
- {
- throw new NotImplementedException();
- }
+ public bool SaveMenusByRoleId(string? roleId, List menuIds)
+ {
+ throw new NotImplementedException();
}
}
diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/DBLog.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/DBLog.cs
index c410bf13..6b3fb959 100644
--- a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/DBLog.cs
+++ b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/DBLog.cs
@@ -1,33 +1,32 @@
using System.ComponentModel;
-namespace BootstrapAdmin.DataAccess.Models
+namespace BootstrapAdmin.DataAccess.Models;
+
+///
+/// 后台数据库脚本执行日志实体类
+///
+public class DBLog
{
///
- /// 后台数据库脚本执行日志实体类
+ /// 获得/设置 主键ID
///
- public class DBLog
- {
- ///
- /// 获得/设置 主键ID
- ///
- public string? Id { get; set; }
+ public string? Id { get; set; }
- ///
- /// 获得/设置 当前登陆名
- ///
- [DisplayName("所属用户")]
- public string? UserName { get; set; }
+ ///
+ /// 获得/设置 当前登陆名
+ ///
+ [DisplayName("所属用户")]
+ public string? UserName { get; set; }
- ///
- /// 获得/设置 数据库执行脚本
- ///
- [DisplayName("脚本内容")]
- public string SQL { get; set; } = "";
+ ///
+ /// 获得/设置 数据库执行脚本
+ ///
+ [DisplayName("脚本内容")]
+ public string SQL { get; set; } = "";
- ///
- /// 获取/设置 用户角色关联状态 checked 标示已经关联 '' 标示未关联
- ///
- [DisplayName("执行时间")]
- public DateTime LogTime { get; set; }
- }
+ ///
+ /// 获取/设置 用户角色关联状态 checked 标示已经关联 '' 标示未关联
+ ///
+ [DisplayName("执行时间")]
+ public DateTime LogTime { get; set; }
}
diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/Dict.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/Dict.cs
index 0089cc26..bee4dcf0 100644
--- a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/Dict.cs
+++ b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/Dict.cs
@@ -2,43 +2,42 @@
using System.ComponentModel.DataAnnotations;
-namespace BootstrapAdmin.DataAccess.Models
+namespace BootstrapAdmin.DataAccess.Models;
+
+///
+/// 字典配置项
+///
+public class Dict
{
///
- /// 字典配置项
+ /// 获得/设置 字典主键 数据库自增列
///
- public class Dict
- {
- ///
- /// 获得/设置 字典主键 数据库自增列
- ///
- public string? Id { get; set; }
+ public string? Id { get; set; }
- ///
- /// 获得/设置 字典标签
- ///
- [Required(ErrorMessage = "{0}不可为空")]
- [Display(Name = "字典标签")]
- public string Category { get; set; } = "";
+ ///
+ /// 获得/设置 字典标签
+ ///
+ [Required(ErrorMessage = "{0}不可为空")]
+ [Display(Name = "字典标签")]
+ public string Category { get; set; } = "";
- ///
- /// 获得/设置 字典名称
- ///
- [Required(ErrorMessage = "{0}不可为空")]
- [Display(Name = "字典名称")]
- public string Name { get; set; } = "";
+ ///
+ /// 获得/设置 字典名称
+ ///
+ [Required(ErrorMessage = "{0}不可为空")]
+ [Display(Name = "字典名称")]
+ public string Name { get; set; } = "";
- ///
- /// 获得/设置 字典字典值
- ///
- [Required(ErrorMessage = "{0}不可为空")]
- [Display(Name = "字典代码")]
- public string Code { get; set; } = "";
+ ///
+ /// 获得/设置 字典字典值
+ ///
+ [Required(ErrorMessage = "{0}不可为空")]
+ [Display(Name = "字典代码")]
+ public string Code { get; set; } = "";
- ///
- /// 获得/设置 字典定义值 0 表示系统使用,1 表示用户自定义 默认为 1
- ///
- [Display(Name = "字典类型")]
- public EnumDictDefine Define { get; set; } = EnumDictDefine.Customer;
- }
+ ///
+ /// 获得/设置 字典定义值 0 表示系统使用,1 表示用户自定义 默认为 1
+ ///
+ [Display(Name = "字典类型")]
+ public EnumDictDefine Define { get; set; } = EnumDictDefine.Customer;
}
diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/EnumDictDefine.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/EnumDictDefine.cs
index 1aceff4b..0f7a528e 100644
--- a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/EnumDictDefine.cs
+++ b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/EnumDictDefine.cs
@@ -1,22 +1,21 @@
using System.ComponentModel;
-namespace BootstrapAdmin.DataAccess.Models
+namespace BootstrapAdmin.DataAccess.Models;
+
+///
+/// 字典定义值 0 表示系统使用,1 表示用户自定义 默认为 1
+///
+public enum EnumDictDefine
{
///
- /// 字典定义值 0 表示系统使用,1 表示用户自定义 默认为 1
+ /// 系统使用
///
- public enum EnumDictDefine
- {
- ///
- /// 系统使用
- ///
- [Description("系统使用")]
- System,
+ [Description("系统使用")]
+ System,
- ///
- /// 用户自定义
- ///
- [Description("自定义")]
- Customer
- }
+ ///
+ /// 用户自定义
+ ///
+ [Description("自定义")]
+ Customer
}
diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/EnumNavigationCategory.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/EnumNavigationCategory.cs
index d9a48e0b..68ed3f36 100644
--- a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/EnumNavigationCategory.cs
+++ b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/EnumNavigationCategory.cs
@@ -1,22 +1,21 @@
using System.ComponentModel;
-namespace BootstrapAdmin.DataAccess.Models
+namespace BootstrapAdmin.DataAccess.Models;
+
+///
+/// 菜单分类 0 表示系统菜单 1 表示用户自定义菜单
+///
+public enum EnumNavigationCategory
{
///
- /// 菜单分类 0 表示系统菜单 1 表示用户自定义菜单
+ /// 系统使用
///
- public enum EnumNavigationCategory
- {
- ///
- /// 系统使用
- ///
- [Description("系统使用")]
- System,
+ [Description("系统使用")]
+ System,
- ///
- /// 用户自定义
- ///
- [Description("自定义")]
- Customer
- }
+ ///
+ /// 用户自定义
+ ///
+ [Description("自定义")]
+ Customer
}
diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/EnumResource.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/EnumResource.cs
index e82699fe..2874fbd2 100644
--- a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/EnumResource.cs
+++ b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/EnumResource.cs
@@ -1,26 +1,25 @@
using System.ComponentModel;
-namespace BootstrapAdmin.DataAccess.Models
+namespace BootstrapAdmin.DataAccess.Models;
+
+///
+/// 资源类型枚举 0 表示菜单 1 表示资源 2 表示按钮
+///
+public enum EnumResource
{
///
- /// 资源类型枚举 0 表示菜单 1 表示资源 2 表示按钮
+ ///
///
- public enum EnumResource
- {
- ///
- ///
- ///
- [Description("菜单")]
- Navigation,
- ///
- ///
- ///
- [Description("资源")]
- Resource,
- ///
- ///
- ///
- [Description("代码块")]
- Block
- }
+ [Description("菜单")]
+ Navigation,
+ ///
+ ///
+ ///
+ [Description("资源")]
+ Resource,
+ ///
+ ///
+ ///
+ [Description("代码块")]
+ Block
}
diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/Group.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/Group.cs
index b425f218..08f5b387 100644
--- a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/Group.cs
+++ b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/Group.cs
@@ -1,37 +1,36 @@
using System.ComponentModel.DataAnnotations;
-namespace BootstrapAdmin.DataAccess.Models
+namespace BootstrapAdmin.DataAccess.Models;
+
+///
+/// Group 实体类
+///
+public class Group
{
///
- /// Group 实体类
+ /// 获得/设置 主键 ID
///
- public class Group
- {
- ///
- /// 获得/设置 主键 ID
- ///
- public string? Id { get; set; }
+ public string? Id { get; set; }
- ///
- /// 获得/设置 群组名称
- ///
- [Display(Name = "群组名称")]
- [NotNull]
- public string? GroupName { get; set; }
+ ///
+ /// 获得/设置 群组名称
+ ///
+ [Display(Name = "群组名称")]
+ [NotNull]
+ public string? GroupName { get; set; }
- ///
- /// 获得/设置 群组编码
- ///
- [Display(Name = "群组编码")]
- [NotNull]
- public string? GroupCode { get; set; }
+ ///
+ /// 获得/设置 群组编码
+ ///
+ [Display(Name = "群组编码")]
+ [NotNull]
+ public string? GroupCode { get; set; }
- ///
- /// 获得/设置 群组描述
- ///
- [Display(Name = "群组描述")]
- public string? Description { get; set; }
+ ///
+ /// 获得/设置 群组描述
+ ///
+ [Display(Name = "群组描述")]
+ public string? Description { get; set; }
- public override string ToString() => $"{GroupName} ({GroupCode})";
- }
+ public override string ToString() => $"{GroupName} ({GroupCode})";
}
diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/LoginUser.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/LoginUser.cs
index 32db30c2..e612c1ff 100644
--- a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/LoginUser.cs
+++ b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/LoginUser.cs
@@ -1,63 +1,62 @@
using System.ComponentModel;
-namespace Bootstrap.DataAccess
+namespace Bootstrap.DataAccess;
+
+///
+/// 登录用户信息实体类
+///
+public class LoginLog
{
///
- /// 登录用户信息实体类
+ /// 获得/设置 Id
///
- public class LoginLog
- {
- ///
- /// 获得/设置 Id
- ///
- public string? Id { get; set; }
+ public string? Id { get; set; }
- ///
- /// 获得/设置 用户名
- ///
- [DisplayName("登录名称")]
- public string UserName { get; set; } = "";
+ ///
+ /// 获得/设置 用户名
+ ///
+ [DisplayName("登录名称")]
+ public string UserName { get; set; } = "";
- ///
- /// 获得/设置 登录时间
- ///
- [DisplayName("登录时间")]
- public DateTime LoginTime { get; set; }
+ ///
+ /// 获得/设置 登录时间
+ ///
+ [DisplayName("登录时间")]
+ public DateTime LoginTime { get; set; }
- ///
- /// 获得/设置 登录IP地址
- ///
- [DisplayName("主机")]
- public string Ip { get; set; } = "";
+ ///
+ /// 获得/设置 登录IP地址
+ ///
+ [DisplayName("主机")]
+ public string Ip { get; set; } = "";
- ///
- /// 获得/设置 登录浏览器
- ///
- [DisplayName("浏览器")]
- public string Browser { get; set; } = "";
+ ///
+ /// 获得/设置 登录浏览器
+ ///
+ [DisplayName("浏览器")]
+ public string Browser { get; set; } = "";
- ///
- /// 获得/设置 登录操作系统
- ///
- [DisplayName("操作系统")]
- public string OS { get; set; } = "";
+ ///
+ /// 获得/设置 登录操作系统
+ ///
+ [DisplayName("操作系统")]
+ public string OS { get; set; } = "";
- ///
- /// 获得/设置 登录地点
- ///
- [DisplayName("登录地点")]
- public string City { get; set; } = "";
+ ///
+ /// 获得/设置 登录地点
+ ///
+ [DisplayName("登录地点")]
+ public string City { get; set; } = "";
- ///
- /// 获得/设置 登录是否成功
- ///
- [DisplayName("登录结果")]
- public string Result { get; set; } = "";
+ ///
+ /// 获得/设置 登录是否成功
+ ///
+ [DisplayName("登录结果")]
+ public string Result { get; set; } = "";
- ///
- /// 获得/设置 用户 UserAgent
- ///
- [DisplayName("登录名称")]
- public string UserAgent { get; set; } = "";
- }
+ ///
+ /// 获得/设置 用户 UserAgent
+ ///
+ [DisplayName("登录名称")]
+ public string UserAgent { get; set; } = "";
}
diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/Navigation.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/Navigation.cs
index 4d6bc9ed..c302aaa6 100644
--- a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/Navigation.cs
+++ b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/Navigation.cs
@@ -2,76 +2,75 @@
using System.ComponentModel.DataAnnotations;
-namespace BootstrapAdmin.DataAccess.Models
+namespace BootstrapAdmin.DataAccess.Models;
+
+///
+/// Bootstrap Admin 后台管理菜单相关操作实体类
+///
+public class Navigation
{
///
- /// Bootstrap Admin 后台管理菜单相关操作实体类
+ /// 获得/设置 菜单主键ID
///
- public class Navigation
- {
- ///
- /// 获得/设置 菜单主键ID
- ///
- public string? Id { set; get; }
+ public string? Id { set; get; }
- ///
- /// 获得/设置 父级菜单ID 默认为 0
- ///
- public string ParentId { set; get; } = "0";
+ ///
+ /// 获得/设置 父级菜单ID 默认为 0
+ ///
+ public string ParentId { set; get; } = "0";
- ///
- /// 获得/设置 菜单名称
- ///
- [Display(Name = "名称")]
- [NotNull]
- public string? Name { get; set; }
+ ///
+ /// 获得/设置 菜单名称
+ ///
+ [Display(Name = "名称")]
+ [NotNull]
+ public string? Name { get; set; }
- ///
- /// 获得/设置 菜单序号
- ///
- [Display(Name = "序号")]
- public int Order { get; set; }
+ ///
+ /// 获得/设置 菜单序号
+ ///
+ [Display(Name = "序号")]
+ public int Order { get; set; }
- ///
- /// 获得/设置 菜单图标
- ///
- [Display(Name = "图标")]
- public string? Icon { get; set; }
+ ///
+ /// 获得/设置 菜单图标
+ ///
+ [Display(Name = "图标")]
+ public string? Icon { get; set; }
- ///
- /// 获得/设置 菜单URL地址
- ///
- [NotNull]
- [Display(Name = "地址")]
- public string? Url { get; set; }
+ ///
+ /// 获得/设置 菜单URL地址
+ ///
+ [NotNull]
+ [Display(Name = "地址")]
+ public string? Url { get; set; }
- ///
- /// 获得/设置 菜单分类, 0 表示系统菜单 1 表示用户自定义菜单
- ///
- [Display(Name = "类别")]
- public EnumNavigationCategory Category { get; set; }
+ ///
+ /// 获得/设置 菜单分类, 0 表示系统菜单 1 表示用户自定义菜单
+ ///
+ [Display(Name = "类别")]
+ public EnumNavigationCategory Category { get; set; }
- ///
- /// 获得/设置 链接目标
- ///
- [Display(Name = "目标")]
- public string? Target { get; set; }
+ ///
+ /// 获得/设置 链接目标
+ ///
+ [Display(Name = "目标")]
+ public string? Target { get; set; }
- ///
- /// 获得/设置 是否为资源文件, 0 表示菜单 1 表示资源 2 表示按钮
- ///
- [Display(Name = "类型")]
- public EnumResource IsResource { get; set; }
+ ///
+ /// 获得/设置 是否为资源文件, 0 表示菜单 1 表示资源 2 表示按钮
+ ///
+ [Display(Name = "类型")]
+ public EnumResource IsResource { get; set; }
- ///
- /// 获得/设置 所属应用程序,此属性由BA后台字典表分配
- ///
- [Display(Name = "所属应用")]
- public string? Application { get; set; }
+ ///
+ /// 获得/设置 所属应用程序,此属性由BA后台字典表分配
+ ///
+ [Display(Name = "所属应用")]
+ public string? Application { get; set; }
- ///
- ///
- ///
- public bool HasChildren { get; set; }
- }
+ ///
+ ///
+ ///
+ public bool HasChildren { get; set; }
}
diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/Role.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/Role.cs
index 7a262c5a..ce6b65f6 100644
--- a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/Role.cs
+++ b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/Role.cs
@@ -1,30 +1,29 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
-namespace BootstrapAdmin.DataAccess.Models
+namespace BootstrapAdmin.DataAccess.Models;
+
+///
+/// Role 实体类
+///
+public class Role
{
///
- /// Role 实体类
+ /// 获得/设置 角色主键ID
///
- public class Role
- {
- ///
- /// 获得/设置 角色主键ID
- ///
- public string? Id { get; set; }
+ public string? Id { get; set; }
- ///
- /// 获得/设置 角色名称
- ///
- [DisplayName("角色名称")]
- [NotNull]
- public string? RoleName { get; set; }
+ ///
+ /// 获得/设置 角色名称
+ ///
+ [DisplayName("角色名称")]
+ [NotNull]
+ public string? RoleName { get; set; }
- ///
- /// 获得/设置 角色描述
- ///
- [DisplayName("角色描述")]
- [NotNull]
- public string? Description { get; set; }
- }
+ ///
+ /// 获得/设置 角色描述
+ ///
+ [DisplayName("角色描述")]
+ [NotNull]
+ public string? Description { get; set; }
}
diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/User.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/User.cs
index 7fdfad86..54f22a9e 100644
--- a/src/blazor/admin/BootstrapAdmin.DataAccess.Models/User.cs
+++ b/src/blazor/admin/BootstrapAdmin.DataAccess.Models/User.cs
@@ -1,152 +1,151 @@
using System.ComponentModel.DataAnnotations;
-namespace BootstrapAdmin.DataAccess.Models
+namespace BootstrapAdmin.DataAccess.Models;
+
+///
+///
+///
+public class User
{
///
- ///
+ /// 获得/设置 系统登录用户名
///
- public class User
- {
- ///
- /// 获得/设置 系统登录用户名
- ///
- [Display(Name = "登录名称")]
- public string? UserName { get; set; }
-
- ///
- /// 获得/设置 用户显示名称
- ///
- [Display(Name = "显示名称")]
- [Required(ErrorMessage = "{0}不可为空")]
- [MaxLength(50, ErrorMessage = "{0}不能超过 50 个字符")]
- public string? DisplayName { get; set; }
-
- ///
- /// 获得/设置 用户头像图标路径
- ///
- [Display(Name = "用户头像")]
- public string? Icon { get; set; }
-
- ///
- /// 获得/设置 用户设置样式表名称
- ///
- [Display(Name = "主题")]
- public string? Css { get; set; }
-
- ///
- /// 获得/设置 用户默认登陆 App 标识
- ///
- [Display(Name = "默认 APP")]
- public string? App { get; set; }
-
- ///
- /// 获得/设置 用户主键ID
- ///
- public string? Id { get; set; }
-
- ///
- /// 获取/设置 密码
- ///
- [Display(Name = "密码")]
- [Required(ErrorMessage = "{0}不可为空")]
- public string? Password { get; set; }
-
- ///
- /// 获取/设置 密码盐
- ///
- public string? PassSalt { get; set; }
-
- ///
- /// 获得/设置 用户注册时间
- ///
- [Display(Name = "注册时间")]
- public DateTime RegisterTime { get; set; } = DateTime.Now;
-
- ///
- /// 获得/设置 用户被批复时间
- ///
- [Display(Name = "授权时间")]
- public DateTime? ApprovedTime { get; set; }
-
- ///
- /// 获得/设置 用户批复人
- ///
- [Display(Name = "授权人")]
- public string? ApprovedBy { get; set; }
-
- ///
- /// 获得/设置 用户的申请理由
- ///
- [Display(Name = "说明")]
- public string? Description { get; set; }
-
- ///
- /// 获得/设置 通知描述 2分钟内为刚刚
- ///
- public string? Period { get; set; }
-
- ///
- /// 获得/设置 新密码
- ///
- [Display(Name = "新密码")]
- [Required(ErrorMessage = "{0}不可为空")]
- [NotNull]
- public string? NewPassword { get; set; }
-
- ///
- /// 获得/设置 新密码
- ///
- [Display(Name = "确认密码")]
- [Required(ErrorMessage = "{0}不可为空")]
- [Compare("NewPassword", ErrorMessage = "{0}与{1}不一致")]
- [NotNull]
- public string? ConfirmPassword { get; set; }
-
- ///
- /// 获得/设置 是否重置密码
- ///
- public int IsReset { get; set; }
-
- ///
- /// 获得/设置 默认格式为 DisplayName (UserName)
- ///
- ///
- public override string ToString() => $"{DisplayName} ({UserName})";
- }
+ [Display(Name = "登录名称")]
+ public string? UserName { get; set; }
///
- /// 用户状态枚举类型
+ /// 获得/设置 用户显示名称
///
- public enum UserStates
- {
- ///
- /// 更改密码
- ///
- ChangePassword,
+ [Display(Name = "显示名称")]
+ [Required(ErrorMessage = "{0}不可为空")]
+ [MaxLength(50, ErrorMessage = "{0}不能超过 50 个字符")]
+ public string? DisplayName { get; set; }
- ///
- /// 更改样式
- ///
- ChangeTheme,
+ ///
+ /// 获得/设置 用户头像图标路径
+ ///
+ [Display(Name = "用户头像")]
+ public string? Icon { get; set; }
- ///
- /// 更改显示名称
- ///
- ChangeDisplayName,
+ ///
+ /// 获得/设置 用户设置样式表名称
+ ///
+ [Display(Name = "主题")]
+ public string? Css { get; set; }
- ///
- /// 审批用户
- ///
- ApproveUser,
+ ///
+ /// 获得/设置 用户默认登陆 App 标识
+ ///
+ [Display(Name = "默认 APP")]
+ public string? App { get; set; }
- ///
- /// 拒绝用户
- ///
- RejectUser,
+ ///
+ /// 获得/设置 用户主键ID
+ ///
+ public string? Id { get; set; }
- ///
- /// 保存默认应用
- ///
- SaveApp
- }
+ ///
+ /// 获取/设置 密码
+ ///
+ [Display(Name = "密码")]
+ [Required(ErrorMessage = "{0}不可为空")]
+ public string? Password { get; set; }
+
+ ///
+ /// 获取/设置 密码盐
+ ///
+ public string? PassSalt { get; set; }
+
+ ///
+ /// 获得/设置 用户注册时间
+ ///
+ [Display(Name = "注册时间")]
+ public DateTime RegisterTime { get; set; } = DateTime.Now;
+
+ ///
+ /// 获得/设置 用户被批复时间
+ ///
+ [Display(Name = "授权时间")]
+ public DateTime? ApprovedTime { get; set; }
+
+ ///
+ /// 获得/设置 用户批复人
+ ///
+ [Display(Name = "授权人")]
+ public string? ApprovedBy { get; set; }
+
+ ///
+ /// 获得/设置 用户的申请理由
+ ///
+ [Display(Name = "说明")]
+ public string? Description { get; set; }
+
+ ///
+ /// 获得/设置 通知描述 2分钟内为刚刚
+ ///
+ public string? Period { get; set; }
+
+ ///
+ /// 获得/设置 新密码
+ ///
+ [Display(Name = "新密码")]
+ [Required(ErrorMessage = "{0}不可为空")]
+ [NotNull]
+ public string? NewPassword { get; set; }
+
+ ///
+ /// 获得/设置 新密码
+ ///
+ [Display(Name = "确认密码")]
+ [Required(ErrorMessage = "{0}不可为空")]
+ [Compare("NewPassword", ErrorMessage = "{0}与{1}不一致")]
+ [NotNull]
+ public string? ConfirmPassword { get; set; }
+
+ ///
+ /// 获得/设置 是否重置密码
+ ///
+ public int IsReset { get; set; }
+
+ ///
+ /// 获得/设置 默认格式为 DisplayName (UserName)
+ ///
+ ///
+ public override string ToString() => $"{DisplayName} ({UserName})";
+}
+
+///
+/// 用户状态枚举类型
+///
+public enum UserStates
+{
+ ///
+ /// 更改密码
+ ///
+ ChangePassword,
+
+ ///
+ /// 更改样式
+ ///
+ ChangeTheme,
+
+ ///
+ /// 更改显示名称
+ ///
+ ChangeDisplayName,
+
+ ///
+ /// 审批用户
+ ///
+ ApproveUser,
+
+ ///
+ /// 拒绝用户
+ ///
+ RejectUser,
+
+ ///
+ /// 保存默认应用
+ ///
+ SaveApp
}
diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.PetaPoco/BootstrapAdmin.DataAccess.PetaPoco.csproj b/src/blazor/admin/BootstrapAdmin.DataAccess.PetaPoco/BootstrapAdmin.DataAccess.PetaPoco.csproj
index a8e98d3d..cb3fe3fa 100644
--- a/src/blazor/admin/BootstrapAdmin.DataAccess.PetaPoco/BootstrapAdmin.DataAccess.PetaPoco.csproj
+++ b/src/blazor/admin/BootstrapAdmin.DataAccess.PetaPoco/BootstrapAdmin.DataAccess.PetaPoco.csproj
@@ -1,13 +1,14 @@
-
+
+
diff --git a/src/blazor/admin/BootstrapAdmin.DataAccess.PetaPoco/BootstrapAdminConventionMapper.cs b/src/blazor/admin/BootstrapAdmin.DataAccess.PetaPoco/BootstrapAdminConventionMapper.cs
index 0085f5d4..47ad5fbb 100644
--- a/src/blazor/admin/BootstrapAdmin.DataAccess.PetaPoco/BootstrapAdminConventionMapper.cs
+++ b/src/blazor/admin/BootstrapAdmin.DataAccess.PetaPoco/BootstrapAdminConventionMapper.cs
@@ -2,73 +2,72 @@
using PetaPoco;
using System.Reflection;
-namespace BootstrapAdmin.DataAccess.PetaPoco
+namespace BootstrapAdmin.DataAccess.PetaPoco;
+
+class BootstrapAdminConventionMapper : ConventionMapper
{
- class BootstrapAdminConventionMapper : ConventionMapper
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override TableInfo GetTableInfo(Type pocoType)
{
- ///
- ///
- ///
- ///
- ///
- public override TableInfo GetTableInfo(Type pocoType)
+ var ti = base.GetTableInfo(pocoType);
+ ti.AutoIncrement = true;
+
+ // 支持 Oracle 数据库
+ ti.SequenceName = $"SEQ_{ti.TableName.ToUpperInvariant()}_ID";
+
+ ti.TableName = pocoType.Name switch
{
- var ti = base.GetTableInfo(pocoType);
- ti.AutoIncrement = true;
-
- // 支持 Oracle 数据库
- ti.SequenceName = $"SEQ_{ti.TableName.ToUpperInvariant()}_ID";
-
- ti.TableName = pocoType.Name switch
- {
- _ => $"{pocoType.Name}s"
- };
- return ti;
- }
-
- ///
- ///
- ///
- ///
- ///
- public override ColumnInfo GetColumnInfo(PropertyInfo pocoProperty) => pocoProperty.DeclaringType?.Name switch
- {
- nameof(Models.User) => GetUserColumnInfo(pocoProperty),
- nameof(Models.Navigation) => GetNavigationColumnInfo(pocoProperty),
- _ => base.GetColumnInfo(pocoProperty)
+ _ => $"{pocoType.Name}s"
};
+ return ti;
+ }
- private ColumnInfo GetUserColumnInfo(PropertyInfo pocoProperty)
- {
- var ci = base.GetColumnInfo(pocoProperty);
- var resultColumns = new List
+ ///
+ ///
+ ///
+ ///
+ ///
+ public override ColumnInfo GetColumnInfo(PropertyInfo pocoProperty) => pocoProperty.DeclaringType?.Name switch
+ {
+ nameof(Models.User) => GetUserColumnInfo(pocoProperty),
+ nameof(Models.Navigation) => GetNavigationColumnInfo(pocoProperty),
+ _ => base.GetColumnInfo(pocoProperty)
+ };
+
+ private ColumnInfo GetUserColumnInfo(PropertyInfo pocoProperty)
+ {
+ var ci = base.GetColumnInfo(pocoProperty);
+ var resultColumns = new List
{
nameof(Models.User.Period),
nameof(Models.User.NewPassword),
nameof(Models.User.ConfirmPassword),
nameof(Models.User.IsReset)
};
- ci.ResultColumn = resultColumns.Any(c => c == ci.ColumnName);
- return ci;
- }
+ ci.ResultColumn = resultColumns.Any(c => c == ci.ColumnName);
+ return ci;
+ }
- private ColumnInfo GetNavigationColumnInfo(PropertyInfo pocoProperty)
- {
- var ci = base.GetColumnInfo(pocoProperty);
- var resultColumns = new List
+ private ColumnInfo GetNavigationColumnInfo(PropertyInfo pocoProperty)
+ {
+ var ci = base.GetColumnInfo(pocoProperty);
+ var resultColumns = new List
{
nameof(Models.Navigation.HasChildren)
};
- ci.ResultColumn = resultColumns.Any(c => c == ci.ColumnName);
- return ci;
- }
-
- public override Func