diff --git a/Admin.NET/Admin.NET.Core/Service/Enum/SysEnumService.cs b/Admin.NET/Admin.NET.Core/Service/Enum/SysEnumService.cs index 526f70ff..edf0a2d6 100644 --- a/Admin.NET/Admin.NET.Core/Service/Enum/SysEnumService.cs +++ b/Admin.NET/Admin.NET.Core/Service/Enum/SysEnumService.cs @@ -31,7 +31,8 @@ public class SysEnumService : IDynamicApiController, ITransient public List GetEnumTypeList() { var enumTypeList = App.EffectiveTypes.Where(t => t.IsEnum) - .Where(t => _enumOptions.EntityAssemblyNames.Contains(t.Assembly.GetName().Name) || _enumOptions.EntityAssemblyNames.Any(name => t.Assembly.GetName().Name.Contains(name))) + .Where(t => _enumOptions.EntityAssemblyNames.Contains(t.Assembly.GetName().Name) || + _enumOptions.EntityAssemblyNames.Any(name => t.Assembly.GetName().Name.Contains(name))) .Where(t => t.GetCustomAttributes(typeof(ErrorCodeTypeAttribute), false).Length == 0) // 排除错误代码类型 .OrderBy(u => u.Name).ThenBy(u => u.FullName) .ToList(); @@ -53,6 +54,7 @@ public class SysEnumService : IDynamicApiController, ITransient var att = ((DescriptionAttribute[])attrs)[0]; description = att.Description; } + var enumType = App.EffectiveTypes.FirstOrDefault(t => t.IsEnum && t.Name == type.Name); return new EnumTypeOutput { @@ -124,13 +126,11 @@ public class SysEnumService : IDynamicApiController, ITransient var (newDictTypes, newDictDatas) = GetNewSysDicts(newEnumType); // 若是Sqlite、PostgreSQL、SqlServer、MySql、GaussDB、Kdbndp则采用批量处理 - bool enableBulk = _db.CurrentConnectionConfig.DbType == SqlSugar.DbType.Sqlite - || _db.CurrentConnectionConfig.DbType == SqlSugar.DbType.PostgreSQL - || _db.CurrentConnectionConfig.DbType == SqlSugar.DbType.SqlServer; - //|| _db.CurrentConnectionConfig.DbType == SqlSugar.DbType.MySql - //|| _db.CurrentConnectionConfig.DbType == SqlSugar.DbType.MySqlConnector - //|| _db.CurrentConnectionConfig.DbType == SqlSugar.DbType.GaussDB - //|| _db.CurrentConnectionConfig.DbType == SqlSugar.DbType.Kdbndp; + bool enableBulk = _db.CurrentConnectionConfig.DbType is SqlSugar.DbType.Sqlite or SqlSugar.DbType.PostgreSQL + or SqlSugar.DbType.SqlServer or SqlSugar.DbType.MySql; + // or SqlSugar.DbType.MySqlConnector + // or SqlSugar.DbType.GaussDB + // or SqlSugar.DbType.Kdbndp; // 执行数据库操作 if (updatedDictTypes.Count > 0)