diff --git a/Admin.NET/Admin.NET.Core/Const/CommonConst.cs b/Admin.NET/Admin.NET.Core/Const/CommonConst.cs
index ef4638e9..671016d9 100644
--- a/Admin.NET/Admin.NET.Core/Const/CommonConst.cs
+++ b/Admin.NET/Admin.NET.Core/Const/CommonConst.cs
@@ -21,6 +21,11 @@ public class CommonConst
/// 日志分组名称
///
public const string SysLogCategoryName = "System.Logging.LoggingMonitor";
+
+ ///
+ /// 最大并发数
+ ///
+ public const int MaxConcurrent = 8;
///
/// 事件-增加异常日志
diff --git a/Admin.NET/Admin.NET.Core/Extension/RepositoryExtension.cs b/Admin.NET/Admin.NET.Core/Extension/RepositoryExtension.cs
index 3937de05..c1b6fd49 100644
--- a/Admin.NET/Admin.NET.Core/Extension/RepositoryExtension.cs
+++ b/Admin.NET/Admin.NET.Core/Extension/RepositoryExtension.cs
@@ -444,4 +444,146 @@ public static class RepositoryExtension
throw Oops.Oh(error);
}
}
+
+ ///
+ /// 初始化表实体
+ ///
+ ///
+ ///
+ ///
+ public static void InitTable(this SqlSugarScopeProvider dbProvider) where T : class, new()
+ {
+ InitTable(dbProvider, typeof(T));
+ }
+
+ ///
+ /// 初始化表实体
+ ///
+ ///
+ ///
+ ///
+ public static void InitTable(this SqlSugarScopeProvider dbProvider, Type entityType)
+ {
+ // 初始化表实体,如果存在分表特性,需要额外处理
+ if (entityType.GetCustomAttribute() == null)
+ dbProvider.CodeFirst.InitTables(entityType);
+ else
+ dbProvider.CodeFirst.SplitTables().InitTables(entityType);
+
+ // 将不存在实体中的字段改为可空
+ var entityInfo = dbProvider.EntityMaintenance.GetEntityInfo(entityType);
+ var dbColumnInfos = dbProvider.DbMaintenance.GetColumnInfosByTableName(entityInfo.DbTableName) ?? [];
+ foreach (var dbColumnInfo in dbColumnInfos.Where(dbColumnInfo => !dbColumnInfo.IsPrimarykey && entityInfo.Columns.All(u => u.DbColumnName != dbColumnInfo.DbColumnName)))
+ {
+ dbColumnInfo.IsNullable = true;
+ dbProvider.DbMaintenance.UpdateColumn(entityInfo.DbTableName, dbColumnInfo);
+ }
+ }
+
+ ///
+ /// 初始化表种子数据
+ ///
+ ///
+ ///
+ ///
+ public static (int, int, int)? InitTableSeedData(this SqlSugarScope db, Action