😎代码优化

This commit is contained in:
zuohuaijun 2024-07-21 17:08:33 +08:00
parent c61c12325b
commit c6c49b31a4
3 changed files with 12 additions and 12 deletions

View File

@ -74,7 +74,7 @@ public partial class SysMenu : EntityBase
/// </summary>
[SugarColumn(ColumnDescription = "图标", Length = 128)]
[MaxLength(128)]
public string? Icon { get; set; } = "ele-Setting";
public string? Icon { get; set; } = "ele-Menu";
/// <summary>
/// 是否内嵌

View File

@ -284,7 +284,7 @@ public static class SqlSugarSetup
// 初始化/创建数据库
if (config.DbSettings.EnableInitDb)
{
Log.Information($"初始化 {config.DbType} 数据库 {config.ConfigId} {config.ConnectionString}");
Log.Information($"初始化数据库 {config.DbType} - {config.ConfigId} - {config.ConnectionString}");
if (config.DbType != SqlSugar.DbType.Oracle)
dbProvider.DbMaintenance.CreateDatabase();
}
@ -292,7 +292,7 @@ public static class SqlSugarSetup
// 初始化表结构
if (config.TableSettings.EnableInitTable)
{
Log.Information($"初始化 {config.DbType} 表结构 {config.ConfigId}");
Log.Information($"初始化表结构 {config.DbType} - {config.ConfigId}");
var entityTypes = App.EffectiveTypes.Where(u => !u.IsInterface && !u.IsAbstract && u.IsClass && u.IsDefined(typeof(SugarTable), false))
.Where(u => !u.GetCustomAttributes<IgnoreTableAttribute>().Any())
.WhereIF(config.TableSettings.EnableIncreTable, u => u.IsDefined(typeof(IncreTableAttribute), false)).ToList();
@ -303,11 +303,11 @@ public static class SqlSugarSetup
entityTypes = entityTypes.Where(u => u.GetCustomAttributes<LogTableAttribute>().Any()).ToList();
else
entityTypes = entityTypes.Where(u => u.GetCustomAttribute<TenantAttribute>()?.configId.ToString() == config.ConfigId.ToString()).ToList(); // 自定义的库
int count = 0, sum = entityTypes.Count();
int count = 0, sum = entityTypes.Count;
foreach (var entityType in entityTypes)
{
Console.WriteLine($"创建表({config.ConfigId} - {++count}/{sum}){entityType}");
Console.WriteLine($"创建表 {entityType} ({config.ConfigId} - {++count}/{sum})");
if (entityType.GetCustomAttribute<SplitTableAttribute>() == null)
dbProvider.CodeFirst.InitTables(entityType);
else
@ -318,12 +318,12 @@ public static class SqlSugarSetup
// 初始化种子数据
if (config.SeedSettings.EnableInitSeed)
{
Log.Information($"初始化 {config.DbType} 种子数据 {config.ConfigId}");
Log.Information($"初始化种子数据 {config.DbType} - {config.ConfigId}");
var seedDataTypes = App.EffectiveTypes.Where(u => !u.IsInterface && !u.IsAbstract && u.IsClass && u.GetInterfaces().Any(i => i.HasImplementedRawGeneric(typeof(ISqlSugarEntitySeedData<>))))
.WhereIF(config.SeedSettings.EnableIncreSeed, u => u.IsDefined(typeof(IncreSeedAttribute), false))
.OrderBy(u => u.GetCustomAttributes(typeof(SeedDataAttribute), false).Length > 0 ? ((SeedDataAttribute)u.GetCustomAttributes(typeof(SeedDataAttribute), false)[0]).Order : 0).ToList();
int count = 0, sum = seedDataTypes.Count();
int count = 0, sum = seedDataTypes.Count;
foreach (var seedType in seedDataTypes)
{
var entityType = seedType.GetInterfaces().First().GetGenericArguments().First();
@ -349,7 +349,7 @@ public static class SqlSugarSetup
if (seedData == null) continue;
var entityInfo = dbProvider.EntityMaintenance.GetEntityInfo(entityType);
Console.WriteLine($"添加数据({config.ConfigId} - {++count}/{sum}){entityInfo.DbTableName}");
Console.WriteLine($"添加数据 {entityInfo.DbTableName} ({config.ConfigId} - {++count}/{sum})");
if (entityType.GetCustomAttribute<SplitTableAttribute>(true) != null)
{

View File

@ -8,7 +8,7 @@
</div>
</template>
<el-tabs v-loading="state.loading" v-model="state.selectedTabName">
<el-tab-pane label="基础信息" style="height: 550px;overflow-y: auto;overflow-x: hidden;">
<el-tab-pane label="基础信息" style="height: 550px; overflow-y: auto; overflow-x: hidden">
<el-form :model="state.ruleForm" ref="ruleFormRef" label-width="auto">
<el-row :gutter="10">
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
@ -144,7 +144,7 @@
</el-row>
</el-form>
</el-tab-pane>
<el-tab-pane label="档案信息" style="height: 550px;overflow-y: auto;overflow-x: hidden;">
<el-tab-pane label="档案信息" style="height: 550px; overflow-y: auto; overflow-x: hidden">
<el-form :model="state.ruleForm" label-width="auto">
<el-row :gutter="10">
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">