diff --git a/Blog.Core.Api/Blog.Core.Api.csproj b/Blog.Core.Api/Blog.Core.Api.csproj index 8bc327ab..669bab33 100644 --- a/Blog.Core.Api/Blog.Core.Api.csproj +++ b/Blog.Core.Api/Blog.Core.Api.csproj @@ -6,7 +6,6 @@ Linux true - default diff --git a/Blog.Core.Api/Blog.Core.Model.xml b/Blog.Core.Api/Blog.Core.Model.xml index 00b4c5be..1b1451c9 100644 --- a/Blog.Core.Api/Blog.Core.Model.xml +++ b/Blog.Core.Api/Blog.Core.Model.xml @@ -4,195 +4,63 @@ Blog.Core.Model - - - 无任何权限 - - - - - 自定义权限 - - - - - 本部门 - - - - - 本部门及以下 - - - - - 仅自己 - - - + - 所有 + 状态
+ 中立字段,某些表可使用某些表不使用
- + - 以下model 来自ids4项目,多库模式,为了调取ids4数据 - 角色表 + 中立字段,某些表可使用某些表不使用
+ 逻辑上的删除,非物理删除
+ 例如:单据删除并非直接删除
- - - 排序 - - - + - 是否激活 + 中立字段
+ 是否内置数据
- + 创建ID - + 创建者 - + 创建时间 - + 修改ID - - - 修改者 - - - - - 修改时间 - - - - - 以下model 来自ids4项目,多库模式,为了调取ids4数据 - 用户表 - - - - - 这是爱 - - - - - id - - - - - 姓名 - - - - - 年龄 - - - - - 通用返回信息类 - - - - - 状态码 - - - - - 操作是否成功 - - - - - 返回信息 - - - - - 开发者信息 - - - - - 返回数据集合 - - - - - 返回成功 - - 消息 - - - - - 返回成功 - - 消息 - 数据 - - - - - 返回失败 - - 消息 - - - - - 返回失败 - - 消息 - 数据 - - - - - 返回消息 - - 失败/成功 - 消息 - 数据 - - - + - 状态码 + 更新者 - + - 操作是否成功 + 修改日期 - + - 返回信息 + 数据版本 - + - 返回数据集合 + 软删除 过滤器 @@ -837,65 +705,6 @@ 修改时间 - - - 状态
- 中立字段,某些表可使用某些表不使用 -
-
- - - 中立字段,某些表可使用某些表不使用
- 逻辑上的删除,非物理删除
- 例如:单据删除并非直接删除 -
-
- - - 中立字段
- 是否内置数据 -
-
- - - 创建ID - - - - - 创建者 - - - - - 创建时间 - - - - - 修改ID - - - - - 更新者 - - - - - 修改日期 - - - - - 数据版本 - - - - - 软删除 过滤器 - - 系统租户表
@@ -1239,6 +1048,11 @@ 金额
+ + + 备注(测试增加字段,多表迁移) + + 多租户-多库方案 业务表
@@ -1255,6 +1069,11 @@ 金额
+ + + 备注(测试增加字段,多库迁移) + + Tibug 类别 @@ -1890,6 +1709,234 @@ 角色ID + + + 租户模型接口 + + + + + 租户Id + + + + + 标识 多租户 的业务表
+ 默认设置是多库
+ 公共表无需区分 直接使用主库 各自业务在各自库中
+
+
+ + + 租户隔离方案 + + + + + Id隔离 + + + + + 库隔离 + + + + + 表隔离 + + + + + 无任何权限 + + + + + 自定义权限 + + + + + 本部门 + + + + + 本部门及以下 + + + + + 仅自己 + + + + + 所有 + + + + + 以下model 来自ids4项目,多库模式,为了调取ids4数据 + 角色表 + + + + + 排序 + + + + + 是否激活 + + + + + 创建ID + + + + + 创建者 + + + + + 创建时间 + + + + + 修改ID + + + + + 修改者 + + + + + 修改时间 + + + + + 以下model 来自ids4项目,多库模式,为了调取ids4数据 + 用户表 + + + + + 这是爱 + + + + + id + + + + + 姓名 + + + + + 年龄 + + + + + 通用返回信息类 + + + + + 状态码 + + + + + 操作是否成功 + + + + + 返回信息 + + + + + 开发者信息 + + + + + 返回数据集合 + + + + + 返回成功 + + 消息 + + + + + 返回成功 + + 消息 + 数据 + + + + + 返回失败 + + 消息 + + + + + 返回失败 + + 消息 + 数据 + + + + + 返回消息 + + 失败/成功 + 消息 + 数据 + + + + + 状态码 + + + + + 操作是否成功 + + + + + 返回信息 + + + + + 返回数据集合 + + 通用分页信息类 @@ -1992,43 +2039,6 @@ 返回数据集 - - - 租户模型接口 - - - - - 租户Id - - - - - 标识 多租户 的业务表
- 默认设置是多库
- 公共表无需区分 直接使用主库 各自业务在各自库中
-
-
- - - 租户隔离方案 - - - - - Id隔离 - - - - - 库隔离 - - - - - 表隔离 - - 广告类 diff --git a/Blog.Core.Api/Controllers/Systems/DataBaseController.cs b/Blog.Core.Api/Controllers/Systems/DataBaseController.cs index 1f7b3089..7c103e1e 100644 --- a/Blog.Core.Api/Controllers/Systems/DataBaseController.cs +++ b/Blog.Core.Api/Controllers/Systems/DataBaseController.cs @@ -3,9 +3,9 @@ using Blog.Core.Common.DB; using Blog.Core.Controllers; using Blog.Core.Model; +using Blog.Core.Model.Base.Tenants; using Blog.Core.Model.Models; using Blog.Core.Model.Systems.DataBase; -using Blog.Core.Model.Tenants; using Mapster; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; diff --git a/Blog.Core.Api/Controllers/Systems/DynamicCodeFirstController.cs b/Blog.Core.Api/Controllers/Systems/DynamicCodeFirstController.cs index 37c84791..5d00c67e 100644 --- a/Blog.Core.Api/Controllers/Systems/DynamicCodeFirstController.cs +++ b/Blog.Core.Api/Controllers/Systems/DynamicCodeFirstController.cs @@ -1,7 +1,7 @@ using Blog.Core.Common.DB.Extension; using Blog.Core.Controllers; using Blog.Core.Model; -using Blog.Core.Model.Models.RootTkey; +using Blog.Core.Model.Base.RootTkey; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using NetTaste; diff --git a/Blog.Core.Api/Controllers/Tenant/TenantByDbController.cs b/Blog.Core.Api/Controllers/Tenant/TenantByDbController.cs index 046f7f7b..4622b02c 100644 --- a/Blog.Core.Api/Controllers/Tenant/TenantByDbController.cs +++ b/Blog.Core.Api/Controllers/Tenant/TenantByDbController.cs @@ -3,6 +3,7 @@ using Blog.Core.IServices.BASE; using Blog.Core.Model; using Blog.Core.Model.Models; +using Blog.Core.Model.Models.Tenant; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; diff --git a/Blog.Core.Api/Controllers/Tenant/TenantByIdController.cs b/Blog.Core.Api/Controllers/Tenant/TenantByIdController.cs index b015bc6d..06767ed4 100644 --- a/Blog.Core.Api/Controllers/Tenant/TenantByIdController.cs +++ b/Blog.Core.Api/Controllers/Tenant/TenantByIdController.cs @@ -3,6 +3,7 @@ using Blog.Core.IServices.BASE; using Blog.Core.Model; using Blog.Core.Model.Models; +using Blog.Core.Model.Models.Tenant; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; diff --git a/Blog.Core.Api/Controllers/Tenant/TenantByTableController.cs b/Blog.Core.Api/Controllers/Tenant/TenantByTableController.cs index 6c0b110e..b8c115ed 100644 --- a/Blog.Core.Api/Controllers/Tenant/TenantByTableController.cs +++ b/Blog.Core.Api/Controllers/Tenant/TenantByTableController.cs @@ -3,6 +3,7 @@ using Blog.Core.IServices.BASE; using Blog.Core.Model; using Blog.Core.Model.Models; +using Blog.Core.Model.Models.Tenant; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; diff --git a/Blog.Core.Common/Blog.Core.Common.csproj b/Blog.Core.Common/Blog.Core.Common.csproj index d147fce9..0fe60252 100644 --- a/Blog.Core.Common/Blog.Core.Common.csproj +++ b/Blog.Core.Common/Blog.Core.Common.csproj @@ -44,6 +44,7 @@ + diff --git a/Blog.Core.Common/DB/Aop/SqlsugarAop.cs b/Blog.Core.Common/DB/Aop/SqlsugarAop.cs index 7d2031ad..7e5d86bd 100644 --- a/Blog.Core.Common/DB/Aop/SqlsugarAop.cs +++ b/Blog.Core.Common/DB/Aop/SqlsugarAop.cs @@ -1,5 +1,3 @@ -using Blog.Core.Model.Models.RootTkey; -using Blog.Core.Model.Tenants; using SqlSugar; using StackExchange.Profiling; using System; @@ -7,6 +5,8 @@ using Blog.Core.Common.LogHelper; using Blog.Core.Common.Utility; using Blog.Core.Model; +using Blog.Core.Model.Base.RootTkey; +using Blog.Core.Model.Base.Tenants; namespace Blog.Core.Common.DB.Aop; diff --git a/Blog.Core.Common/DB/EntityUtility.cs b/Blog.Core.Common/DB/EntityUtility.cs index f997a1eb..423186ed 100644 --- a/Blog.Core.Common/DB/EntityUtility.cs +++ b/Blog.Core.Common/DB/EntityUtility.cs @@ -6,6 +6,7 @@ using System.Diagnostics; using System.Linq; using System.Reflection; +using Blog.Core.Model.Base.RootTkey; namespace Blog.Core.Common.DB; diff --git a/Blog.Core.Common/DB/RepositorySetting.cs b/Blog.Core.Common/DB/RepositorySetting.cs index bfca7174..ea5b026a 100644 --- a/Blog.Core.Common/DB/RepositorySetting.cs +++ b/Blog.Core.Common/DB/RepositorySetting.cs @@ -1,10 +1,10 @@ -using Blog.Core.Model.Models.RootTkey; -using Blog.Core.Model.Models.RootTkey.Interface; -using Blog.Core.Model.Tenants; -using SqlSugar; +using SqlSugar; using System; using System.Collections.Generic; using System.Linq; +using Blog.Core.Model.Base.RootTkey; +using Blog.Core.Model.Base.RootTkey.Interface; +using Blog.Core.Model.Base.Tenants; namespace Blog.Core.Common.DB; diff --git a/Blog.Core.Common/DB/TenantUtil.cs b/Blog.Core.Common/DB/TenantUtil.cs index 8395c271..e4aae11d 100644 --- a/Blog.Core.Common/DB/TenantUtil.cs +++ b/Blog.Core.Common/DB/TenantUtil.cs @@ -3,8 +3,8 @@ using System.IO; using System.Linq; using System.Reflection; +using Blog.Core.Model.Base.Tenants; using Blog.Core.Model.Models; -using Blog.Core.Model.Tenants; using SqlSugar; namespace Blog.Core.Common.DB; diff --git a/Blog.Core.Common/Seed/DBSeed.cs b/Blog.Core.Common/Seed/DBSeed.cs index 29222802..4435914d 100644 --- a/Blog.Core.Common/Seed/DBSeed.cs +++ b/Blog.Core.Common/Seed/DBSeed.cs @@ -2,7 +2,6 @@ using Blog.Core.Common.Extensions; using Blog.Core.Common.Helper; using Blog.Core.Model.Models; -using Blog.Core.Model.Tenants; using Magicodes.ExporterAndImporter.Excel; using Newtonsoft.Json; using SqlSugar; @@ -10,46 +9,50 @@ using System.Reflection; using System.Text; using Blog.Core.Common.Const; +using Blog.Core.Migrate.Core; +using Blog.Core.Model.Base.Tenants; using Microsoft.Data.SqlClient; +using Serilog; namespace Blog.Core.Common.Seed { public class DBSeed { - private static string SeedDataFolder = "BlogCore.Data.json/{0}.tsv"; + private static string _seedDataFolder = "BlogCore.Data.json/{0}.tsv"; /// /// 异步添加种子数据 /// /// - /// + /// /// - public static async Task SeedAsync(MyContext myContext, string WebRootPath) + public static async Task SeedAsync(MyContext myContext, string webRootPath) { + var db = myContext.Db; try { - if (string.IsNullOrEmpty(WebRootPath)) + if (string.IsNullOrEmpty(webRootPath)) { throw new Exception("获取wwwroot路径时,异常!"); } - SeedDataFolder = Path.Combine(WebRootPath, SeedDataFolder); + _seedDataFolder = Path.Combine(webRootPath, _seedDataFolder); + + Log.Information("===============Blog.Core DataBase Set=================="); + Log.Information("Master DB ConId: {ConfigId}", myContext.Db.CurrentConnectionConfig.ConfigId); + Log.Information("Master DB Type: {DbType}", myContext.Db.CurrentConnectionConfig.DbType); + Log.Information("Master DB ConnectString: {ConnectionString}", myContext.Db.CurrentConnectionConfig.ConnectionString); - Console.WriteLine("************ Blog.Core DataBase Set *****************"); - Console.WriteLine($"Master DB ConId: {myContext.Db.CurrentConnectionConfig.ConfigId}"); - Console.WriteLine($"Master DB Type: {myContext.Db.CurrentConnectionConfig.DbType}"); - Console.WriteLine($"Master DB ConnectString: {myContext.Db.CurrentConnectionConfig.ConnectionString}"); - Console.WriteLine(); if (BaseDBConfig.MainConfig.SlaveConnectionConfigs.AnyNoException()) { var index = 0; BaseDBConfig.MainConfig.SlaveConnectionConfigs.ForEach(m => { index++; - Console.WriteLine($"Slave{index} DB HitRate: {m.HitRate}"); - Console.WriteLine($"Slave{index} DB ConnectString: {m.ConnectionString}"); - Console.WriteLine($"--------------------------------------"); + Log.Information("Slave{Index} DB HitRate: {ObjHitRate}", index, m.HitRate); + Log.Information("Slave{Index} DB ConnectString: {ObjConnectionString}", index, m.ConnectionString); + Log.Information($"--------------------------------------"); }); } else if (BaseDBConfig.ReuseConfigs.AnyNoException()) @@ -58,36 +61,34 @@ public static async Task SeedAsync(MyContext myContext, string WebRootPath) BaseDBConfig.ReuseConfigs.ForEach(m => { index++; - Console.WriteLine($"Reuse{index} DB ID: {m.ConfigId}"); - Console.WriteLine($"Reuse{index} DB Type: {m.DbType}"); - Console.WriteLine($"Reuse{index} DB ConnectString: {m.ConnectionString}"); - Console.WriteLine($"--------------------------------------"); + Log.Information("Reuse{Index} DB ID: {ObjConfigId}", index, m.ConfigId); + Log.Information("Reuse{Index} DB Type: {ObjDbType}", index, m.DbType); + Log.Information("Reuse{Index} DB ConnectString: {ObjConnectionString}", index, m.ConnectionString); + Log.Information($"--------------------------------------"); }); } - Console.WriteLine(); - // 创建数据库 - Console.WriteLine($"Create Database(The Db Id:{MyContext.ConnId})..."); + Log.Information("Create Database(The Db Id:{ConnId})...", MyContext.ConnId); - if (MyContext.DbType != SqlSugar.DbType.Oracle && MyContext.DbType != SqlSugar.DbType.Dm) + if (MyContext.DbType != DbType.Oracle && MyContext.DbType != DbType.Dm) { myContext.Db.DbMaintenance.CreateDatabase(); SqlConnection.ClearAllPools(); - ConsoleHelper.WriteSuccessLine($"Database created successfully!"); + Log.Information($"Database created successfully!"); } else { //Oracle 数据库不支持该操作 - ConsoleHelper.WriteSuccessLine($"Oracle 数据库不支持该操作,可手动创建Oracle/Dm数据库!"); + Log.Warning($"Oracle 数据库不支持该操作,可手动创建Oracle/Dm数据库!"); } // 创建数据库表,遍历指定命名空间下的class, // 注意不要把其他命名空间下的也添加进来。 - Console.WriteLine("Create Tables..."); + Log.Information("Create Tables..."); var path = AppDomain.CurrentDomain.RelativeSearchPath ?? AppDomain.CurrentDomain.BaseDirectory; - var referencedAssemblies = System.IO.Directory.GetFiles(path, "Blog.Core.Model.dll") + var referencedAssemblies = Directory.GetFiles(path, "Blog.Core.Model.dll") .Select(Assembly.LoadFrom).ToArray(); var modelTypes = referencedAssemblies .SelectMany(a => a.DefinedTypes) @@ -95,23 +96,13 @@ public static async Task SeedAsync(MyContext myContext, string WebRootPath) .Where(x => x.IsClass && x.Namespace is "Blog.Core.Model.Models") .Where(s => !s.IsDefined(typeof(MultiTenantAttribute), false)) .ToList(); - modelTypes.ForEach(t => - { - // 这里只支持添加表,不支持删除 - // 如果想要删除,数据库直接右键删除,或者联系SqlSugar作者; - if (!myContext.Db.DbMaintenance.IsAnyTable(t.Name)) - { - Console.WriteLine(t.Name); - myContext.Db.CodeFirst.SplitTables().InitTables(t); - } - }); - ConsoleHelper.WriteSuccessLine($"Tables created successfully!"); - Console.WriteLine(); + await MigrateCore.MigrateAsync(db, modelTypes.ToArray()); + Log.Information($"Tables created successfully!"); - if (AppSettings.app(new string[] { "AppSettings", "SeedDBDataEnabled" }).ObjToBool()) + if (AppSettings.app("AppSettings", "SeedDBDataEnabled").ObjToBool()) { JsonSerializerSettings setting = new JsonSerializerSettings(); - JsonConvert.DefaultSettings = new Func(() => + JsonConvert.DefaultSettings = () => { //日期类型默认格式化处理 setting.DateFormatHandling = DateFormatHandling.MicrosoftDateFormat; @@ -124,9 +115,9 @@ public static async Task SeedAsync(MyContext myContext, string WebRootPath) //setting.Converters.Add(new BoolConvert("是,否")); return setting; - }); + }; - Console.WriteLine($"Seeding database data (The Db Id:{MyContext.ConnId})..."); + Log.Information("Seeding database data (The Db Id:{ConnId})...", MyContext.ConnId); var importer = new ExcelImporter(); @@ -136,12 +127,12 @@ public static async Task SeedAsync(MyContext myContext, string WebRootPath) { myContext.GetEntityDB().InsertRange( JsonHelper.ParseFormByJson>( - FileHelper.ReadFile(string.Format(SeedDataFolder, "BlogArticle"), Encoding.UTF8))); - Console.WriteLine("Table:BlogArticle created success!"); + FileHelper.ReadFile(string.Format(_seedDataFolder, "BlogArticle"), Encoding.UTF8))); + Log.Information("Table:BlogArticle created success!"); } else { - Console.WriteLine("Table:BlogArticle already exists..."); + Log.Information("Table:BlogArticle already exists..."); } #endregion @@ -152,14 +143,14 @@ public static async Task SeedAsync(MyContext myContext, string WebRootPath) if (!await myContext.Db.Queryable().AnyAsync()) { var data = JsonConvert.DeserializeObject>( - FileHelper.ReadFile(string.Format(SeedDataFolder, "Modules"), Encoding.UTF8), setting); + FileHelper.ReadFile(string.Format(_seedDataFolder, "Modules"), Encoding.UTF8), setting); myContext.GetEntityDB().InsertRange(data); - Console.WriteLine("Table:Modules created success!"); + Log.Information("Table:Modules created success!"); } else { - Console.WriteLine("Table:Modules already exists..."); + Log.Information("Table:Modules already exists..."); } #endregion @@ -170,14 +161,14 @@ public static async Task SeedAsync(MyContext myContext, string WebRootPath) if (!await myContext.Db.Queryable().AnyAsync()) { var data = JsonConvert.DeserializeObject>( - FileHelper.ReadFile(string.Format(SeedDataFolder, "Permission"), Encoding.UTF8), setting); + FileHelper.ReadFile(string.Format(_seedDataFolder, "Permission"), Encoding.UTF8), setting); myContext.GetEntityDB().InsertRange(data); - Console.WriteLine("Table:Permission created success!"); + Log.Information("Table:Permission created success!"); } else { - Console.WriteLine("Table:Permission already exists..."); + Log.Information("Table:Permission already exists..."); } #endregion @@ -188,17 +179,17 @@ public static async Task SeedAsync(MyContext myContext, string WebRootPath) if (!await myContext.Db.Queryable().AnyAsync()) { var data = JsonConvert.DeserializeObject>( - FileHelper.ReadFile(string.Format(SeedDataFolder, "Role"), Encoding.UTF8), setting); + FileHelper.ReadFile(string.Format(_seedDataFolder, "Role"), Encoding.UTF8), setting); //using var stream = new FileStream(Path.Combine(WebRootPath, "BlogCore.Data.excel", "Role.xlsx"), FileMode.Open); //var result = await importer.Import(stream); //var data = result.Data.ToList(); myContext.GetEntityDB().InsertRange(data); - Console.WriteLine("Table:Role created success!"); + Log.Information("Table:Role created success!"); } else { - Console.WriteLine("Table:Role already exists..."); + Log.Information("Table:Role already exists..."); } #endregion @@ -209,15 +200,15 @@ public static async Task SeedAsync(MyContext myContext, string WebRootPath) if (!await myContext.Db.Queryable().AnyAsync()) { var data = JsonConvert.DeserializeObject>( - FileHelper.ReadFile(string.Format(SeedDataFolder, "RoleModulePermission"), Encoding.UTF8), + FileHelper.ReadFile(string.Format(_seedDataFolder, "RoleModulePermission"), Encoding.UTF8), setting); myContext.GetEntityDB().InsertRange(data); - Console.WriteLine("Table:RoleModulePermission created success!"); + Log.Information("Table:RoleModulePermission created success!"); } else { - Console.WriteLine("Table:RoleModulePermission already exists..."); + Log.Information("Table:RoleModulePermission already exists..."); } #endregion @@ -228,14 +219,14 @@ public static async Task SeedAsync(MyContext myContext, string WebRootPath) if (!await myContext.Db.Queryable().AnyAsync()) { var data = JsonConvert.DeserializeObject>( - FileHelper.ReadFile(string.Format(SeedDataFolder, "Topic"), Encoding.UTF8), setting); + FileHelper.ReadFile(string.Format(_seedDataFolder, "Topic"), Encoding.UTF8), setting); myContext.GetEntityDB().InsertRange(data); - Console.WriteLine("Table:Topic created success!"); + Log.Information("Table:Topic created success!"); } else { - Console.WriteLine("Table:Topic already exists..."); + Log.Information("Table:Topic already exists..."); } #endregion @@ -246,14 +237,14 @@ public static async Task SeedAsync(MyContext myContext, string WebRootPath) if (!await myContext.Db.Queryable().AnyAsync()) { var data = JsonConvert.DeserializeObject>( - FileHelper.ReadFile(string.Format(SeedDataFolder, "TopicDetail"), Encoding.UTF8), setting); + FileHelper.ReadFile(string.Format(_seedDataFolder, "TopicDetail"), Encoding.UTF8), setting); myContext.GetEntityDB().InsertRange(data); - Console.WriteLine("Table:TopicDetail created success!"); + Log.Information("Table:TopicDetail created success!"); } else { - Console.WriteLine("Table:TopicDetail already exists..."); + Log.Information("Table:TopicDetail already exists..."); } #endregion @@ -264,14 +255,14 @@ public static async Task SeedAsync(MyContext myContext, string WebRootPath) if (!await myContext.Db.Queryable().AnyAsync()) { var data = JsonConvert.DeserializeObject>( - FileHelper.ReadFile(string.Format(SeedDataFolder, "UserRole"), Encoding.UTF8), setting); + FileHelper.ReadFile(string.Format(_seedDataFolder, "UserRole"), Encoding.UTF8), setting); myContext.GetEntityDB().InsertRange(data); - Console.WriteLine("Table:UserRole created success!"); + Log.Information("Table:UserRole created success!"); } else { - Console.WriteLine("Table:UserRole already exists..."); + Log.Information("Table:UserRole already exists..."); } #endregion @@ -282,14 +273,14 @@ public static async Task SeedAsync(MyContext myContext, string WebRootPath) if (!await myContext.Db.Queryable().AnyAsync()) { var data = JsonConvert.DeserializeObject>( - FileHelper.ReadFile(string.Format(SeedDataFolder, "sysUserInfo"), Encoding.UTF8), setting); + FileHelper.ReadFile(string.Format(_seedDataFolder, "sysUserInfo"), Encoding.UTF8), setting); myContext.GetEntityDB().InsertRange(data); - Console.WriteLine("Table:sysUserInfo created success!"); + Log.Information("Table:sysUserInfo created success!"); } else { - Console.WriteLine("Table:sysUserInfo already exists..."); + Log.Information("Table:sysUserInfo already exists..."); } #endregion @@ -300,14 +291,14 @@ public static async Task SeedAsync(MyContext myContext, string WebRootPath) if (!await myContext.Db.Queryable().AnyAsync()) { var data = JsonConvert.DeserializeObject>( - FileHelper.ReadFile(string.Format(SeedDataFolder, "TasksQz"), Encoding.UTF8), setting); + FileHelper.ReadFile(string.Format(_seedDataFolder, "TasksQz"), Encoding.UTF8), setting); myContext.GetEntityDB().InsertRange(data); - Console.WriteLine("Table:TasksQz created success!"); + Log.Information("Table:TasksQz created success!"); } else { - Console.WriteLine("Table:TasksQz already exists..."); + Log.Information("Table:TasksQz already exists..."); } #endregion @@ -316,11 +307,11 @@ public static async Task SeedAsync(MyContext myContext, string WebRootPath) if (!await myContext.Db.Queryable().AnyAsync()) { - Console.WriteLine("Table:TasksLog created success!"); + Log.Information("Table:TasksLog created success!"); } else { - Console.WriteLine("Table:TasksLog already exists..."); + Log.Information("Table:TasksLog already exists..."); } #endregion @@ -330,14 +321,14 @@ public static async Task SeedAsync(MyContext myContext, string WebRootPath) if (!await myContext.Db.Queryable().AnyAsync()) { var data = JsonConvert.DeserializeObject>( - FileHelper.ReadFile(string.Format(SeedDataFolder, "Department"), Encoding.UTF8), setting); + FileHelper.ReadFile(string.Format(_seedDataFolder, "Department"), Encoding.UTF8), setting); myContext.GetEntityDB().InsertRange(data); - Console.WriteLine("Table:Department created success!"); + Log.Information("Table:Department created success!"); } else { - Console.WriteLine("Table:Department already exists..."); + Log.Information("Table:Department already exists..."); } #endregion @@ -345,10 +336,8 @@ public static async Task SeedAsync(MyContext myContext, string WebRootPath) //种子初始化 await SeedDataAsync(myContext.Db); - ConsoleHelper.WriteSuccessLine($"Done seeding database!"); + Log.Information($"Done seeding database!"); } - - Console.WriteLine(); } catch (Exception ex) { @@ -362,7 +351,7 @@ public static async Task SeedAsync(MyContext myContext, string WebRootPath) /// /// 种子初始化数据 /// - /// + /// /// private static async Task SeedDataAsync(ISqlSugarClient db) { @@ -385,12 +374,13 @@ private static async Task SeedDataAsync(ISqlSugarClient db) } return false; - }); + }).ToList(); if (!seedDataTypes.Any()) return; foreach (var seedType in seedDataTypes) { dynamic instance = Activator.CreateInstance(seedType); + if (instance is null) continue; //初始化数据 { var seedData = instance.InitSeedData(); @@ -402,7 +392,7 @@ private static async Task SeedDataAsync(ISqlSugarClient db) if (!await db.Queryable(entity.DbTableName, "").AnyAsync()) { await db.Insertable(Enumerable.ToList(seedData)).ExecuteCommandAsync(); - Console.WriteLine($"Table:{entity.DbTableName} init success!"); + Log.Information("Table:{EntityDbTableName} init success!", entity.DbTableName); } } } @@ -416,7 +406,7 @@ private static async Task SeedDataAsync(ISqlSugarClient db) var entity = db.EntityMaintenance.GetEntityInfo(entityType); await db.Storageable(Enumerable.ToList(seedData)).ExecuteCommandAsync(); - Console.WriteLine($"Table:{entity.DbTableName} seedData success!"); + Log.Information("Table:{EntityDbTableName} seedData success!", entity.DbTableName); } } @@ -431,57 +421,35 @@ private static async Task SeedDataAsync(ISqlSugarClient db) /// 迁移日志数据库 /// /// - public static void MigrationLogs(MyContext myContext) + public static async Task MigrationLogsAsync(MyContext myContext) { // 创建数据库表,遍历指定命名空间下的class, // 注意不要把其他命名空间下的也添加进来。 - Console.WriteLine("Create Log Tables..."); + Log.Information("Create Log Tables..."); if (!myContext.Db.IsAnyConnection(SqlSugarConst.LogConfigId.ToLower())) { throw new ApplicationException("未配置日志数据库,请在appsettings.json中DBS节点中配置"); } var logDb = myContext.Db.GetConnection(SqlSugarConst.LogConfigId.ToLower()); - Console.WriteLine($"Create log Database(The Db Id:{SqlSugarConst.LogConfigId.ToLower()})..."); + Log.Information("Create log Database(The Db Id:{Lower})...", SqlSugarConst.LogConfigId.ToLower()); logDb.DbMaintenance.CreateDatabase(); - ConsoleHelper.WriteSuccessLine($"Log Database created successfully!"); + Log.Information($"Log Database created successfully!"); var path = AppDomain.CurrentDomain.RelativeSearchPath ?? AppDomain.CurrentDomain.BaseDirectory; - var referencedAssemblies = System.IO.Directory.GetFiles(path, "Blog.Core.Model.dll") + var referencedAssemblies = Directory.GetFiles(path, "Blog.Core.Model.dll") .Select(Assembly.LoadFrom).ToArray(); var modelTypes = referencedAssemblies .SelectMany(a => a.DefinedTypes) .Select(type => type.AsType()) .Where(x => x.IsClass && x.Namespace != null && x.Namespace.StartsWith("Blog.Core.Model.Logs")) .ToList(); - Stopwatch sw = Stopwatch.StartNew(); - - var tables = logDb.DbMaintenance.GetTableInfoList(); - - modelTypes.ForEach(t => - { - // 这里只支持添加修改表,不支持删除 - // 如果想要删除,数据库直接右键删除,或者联系SqlSugar作者; - if (!tables.Any(s => s.Name.Contains(t.Name))) - { - Console.WriteLine(t.Name); - if (t.GetCustomAttribute() != null) - { - logDb.CodeFirst.SplitTables().InitTables(t); - } - else - { - logDb.CodeFirst.InitTables(t); - } - } - }); - + var sw = Stopwatch.StartNew(); + await MigrateCore.MigrateAsync(logDb, modelTypes.ToArray()); sw.Stop(); - $"Log Tables created successfully! {sw.ElapsedMilliseconds}ms".WriteSuccessLine(); - Console.WriteLine(); + Log.Information("Log Tables created successfully! {SwElapsedMilliseconds}ms", sw.ElapsedMilliseconds); } - /// /// 初始化 多租户 /// @@ -493,10 +461,10 @@ public static async Task TenantSeedAsync(MyContext myContext) .ToListAsync(); if (tenants.Any()) { - Console.WriteLine($@"Init Multi Tenant Db"); + Log.Information($@"Init Multi Tenant Db"); foreach (var tenant in tenants) { - Console.WriteLine($@"Init Multi Tenant Db : {tenant.ConfigId}/{tenant.Name}"); + Log.Information("Init Multi Tenant Db : {TenantConfigId}/{TenantName}", tenant.ConfigId, tenant.Name); await InitTenantSeedAsync(myContext.Db.AsTenant(), tenant.GetConnectionConfig()); } } @@ -513,7 +481,7 @@ public static async Task TenantSeedAsync(MyContext myContext) private static async Task InitTenantSeedAsync(MyContext myContext, List tenants) { - ConsoleHelper.WriteInfoLine($"Init Multi Tenant Tables : {myContext.Db.CurrentConnectionConfig.ConfigId}"); + Log.Information("Init Multi Tenant Tables : {ConfigId}", myContext.Db.CurrentConnectionConfig.ConfigId); // 获取所有实体表-初始化租户业务表 var entityTypes = TenantUtil.GetTenantEntityTypes(TenantTypeEnum.Tables); @@ -521,22 +489,14 @@ private static async Task InitTenantSeedAsync(MyContext myContext, List(); - if (splitTable == null) - db.CodeFirst.InitTables(entityType); - else - db.CodeFirst.SplitTables().InitTables(entityType); - Console.WriteLine(entityType.Name); - } + await MigrateCore.MigrateAsync(db, entityTypes.ToArray()); //多租户初始化种子数据 await TenantSeedDataAsync(db, TenantTypeEnum.Db); @@ -599,11 +550,12 @@ private static async Task TenantSeedDataAsync(ISqlSugarClient db, TenantTypeEnum var eType = esd.GenericTypeArguments[0]; return eType.IsTenantEntity(tenantType); - }); + }).ToList(); if (!seedDataTypes.Any()) return; foreach (var seedType in seedDataTypes) { dynamic instance = Activator.CreateInstance(seedType); + if (instance is null) continue; //初始化数据 { var seedData = instance.InitSeedData(); @@ -615,7 +567,7 @@ private static async Task TenantSeedDataAsync(ISqlSugarClient db, TenantTypeEnum if (!await db.Queryable(entity.DbTableName, "").AnyAsync()) { await db.Insertable(Enumerable.ToList(seedData)).ExecuteCommandAsync(); - Console.WriteLine($"Table:{entity.DbTableName} init success!"); + Log.Information("Table:{EntityDbTableName} init success!", entity.DbTableName); } } } @@ -629,7 +581,7 @@ private static async Task TenantSeedDataAsync(ISqlSugarClient db, TenantTypeEnum var entity = db.EntityMaintenance.GetEntityInfo(entityType); await db.Storageable(Enumerable.ToList(seedData)).ExecuteCommandAsync(); - Console.WriteLine($"Table:{entity.DbTableName} seedData success!"); + Log.Information("Table:{EntityDbTableName} seedData success!", entity.DbTableName); } } diff --git a/Blog.Core.Common/Seed/SeedData/BusinessDataSeedData.cs b/Blog.Core.Common/Seed/SeedData/BusinessDataSeedData.cs index 361cd725..8edf4e2b 100644 --- a/Blog.Core.Common/Seed/SeedData/BusinessDataSeedData.cs +++ b/Blog.Core.Common/Seed/SeedData/BusinessDataSeedData.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using Blog.Core.Model.Models; +using Blog.Core.Model.Models.Tenant; using SqlSugar; namespace Blog.Core.Common.Seed.SeedData; diff --git a/Blog.Core.Common/Seed/SeedData/MultiBusinessDataSeedData.cs b/Blog.Core.Common/Seed/SeedData/MultiBusinessDataSeedData.cs index 4ca1a7dd..2ef264a1 100644 --- a/Blog.Core.Common/Seed/SeedData/MultiBusinessDataSeedData.cs +++ b/Blog.Core.Common/Seed/SeedData/MultiBusinessDataSeedData.cs @@ -2,6 +2,7 @@ using SqlSugar; using System.Collections.Generic; using System.Threading.Tasks; +using Blog.Core.Model.Models.Tenant; namespace Blog.Core.Common.Seed.SeedData; diff --git a/Blog.Core.Common/Seed/SeedData/MultiBusinessSubDataSeedData.cs b/Blog.Core.Common/Seed/SeedData/MultiBusinessSubDataSeedData.cs index e73d4603..26dce8c7 100644 --- a/Blog.Core.Common/Seed/SeedData/MultiBusinessSubDataSeedData.cs +++ b/Blog.Core.Common/Seed/SeedData/MultiBusinessSubDataSeedData.cs @@ -2,6 +2,7 @@ using SqlSugar; using System.Collections.Generic; using System.Threading.Tasks; +using Blog.Core.Model.Models.Tenant; namespace Blog.Core.Common.Seed.SeedData; diff --git a/Blog.Core.Common/Seed/SeedData/SubBusinessDataSeedData.cs b/Blog.Core.Common/Seed/SeedData/SubBusinessDataSeedData.cs index 3d7b8937..887f1cde 100644 --- a/Blog.Core.Common/Seed/SeedData/SubBusinessDataSeedData.cs +++ b/Blog.Core.Common/Seed/SeedData/SubBusinessDataSeedData.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using Blog.Core.Common.Utility; +using Blog.Core.Model.Models.Tenant; namespace Blog.Core.Common.Seed.SeedData; diff --git a/Blog.Core.Common/Seed/SeedData/TenantSeedData.cs b/Blog.Core.Common/Seed/SeedData/TenantSeedData.cs index f33f83b2..8e53a280 100644 --- a/Blog.Core.Common/Seed/SeedData/TenantSeedData.cs +++ b/Blog.Core.Common/Seed/SeedData/TenantSeedData.cs @@ -3,8 +3,8 @@ using System.IO; using System.Threading.Tasks; using Blog.Core.Common.DB; +using Blog.Core.Model.Base.Tenants; using Blog.Core.Model.Models; -using Blog.Core.Model.Tenants; using SqlSugar; namespace Blog.Core.Common.Seed.SeedData; diff --git a/Blog.Core.Extensions/HostedService/SeedDataHostedService.cs b/Blog.Core.Extensions/HostedService/SeedDataHostedService.cs index e1da3d69..bbb6f75a 100644 --- a/Blog.Core.Extensions/HostedService/SeedDataHostedService.cs +++ b/Blog.Core.Extensions/HostedService/SeedDataHostedService.cs @@ -40,7 +40,7 @@ private async Task DoWork() await DBSeed.SeedAsync(_myContext, _webRootPath); //日志 - DBSeed.MigrationLogs(_myContext); + await DBSeed.MigrationLogsAsync(_myContext); //多租户 同步 await DBSeed.TenantSeedAsync(_myContext); diff --git a/Blog.Core.IServices/IPayServices.cs b/Blog.Core.IServices/IPayServices.cs index 712ada39..ba439eea 100644 --- a/Blog.Core.IServices/IPayServices.cs +++ b/Blog.Core.IServices/IPayServices.cs @@ -3,6 +3,7 @@ using Blog.Core.Model; using Blog.Core.Model.ViewModels; using System.Threading.Tasks; +using Blog.Core.Model.Base.RootTkey; namespace Blog.Core.IServices { diff --git a/Blog.Core.Migrate/Attributes/DataDictionaryAttribute.cs b/Blog.Core.Migrate/Attributes/DataDictionaryAttribute.cs new file mode 100644 index 00000000..8acbc0cc --- /dev/null +++ b/Blog.Core.Migrate/Attributes/DataDictionaryAttribute.cs @@ -0,0 +1,13 @@ +namespace Blog.Core.Migrate.Attributes; + +/// +/// 数据字典
+/// 程序内置Code和Name +/// 例如
+/// SO:销售订单
+/// 1:男 +///
+[AttributeUsage(AttributeTargets.Enum)] +public class DataDictionaryAttribute : Attribute +{ +} \ No newline at end of file diff --git a/Blog.Core.Migrate/Attributes/MigrateAttribute.cs b/Blog.Core.Migrate/Attributes/MigrateAttribute.cs new file mode 100644 index 00000000..b66f4ff5 --- /dev/null +++ b/Blog.Core.Migrate/Attributes/MigrateAttribute.cs @@ -0,0 +1,13 @@ +namespace Blog.Core.Migrate.Attributes; + +/// +/// 迁移 +/// +[AttributeUsage(AttributeTargets.Class)] +public class MigrateAttribute : Attribute +{ + /// + /// 是否开启迁移 + /// + public bool Enable { get; set; } = true; +} \ No newline at end of file diff --git a/Blog.Core.Migrate/Attributes/MigrateVersionAttribute.cs b/Blog.Core.Migrate/Attributes/MigrateVersionAttribute.cs new file mode 100644 index 00000000..80ed2467 --- /dev/null +++ b/Blog.Core.Migrate/Attributes/MigrateVersionAttribute.cs @@ -0,0 +1,21 @@ +namespace Blog.Core.Migrate.Attributes; + +/// +/// 标记版本
+/// 提高CodeFirst的性能 不必要做性能牺牲
+/// 修改实体的字段、特性、索引等
+/// 一定要修改版本号!!!
+/// 一定要修改版本号!!!
+/// 一定要修改版本号!!!
+/// 否则不会主动修改 +///
+[AttributeUsage(AttributeTargets.Class)] +public class MigrateVersionAttribute : Attribute +{ + public MigrateVersionAttribute(string version) + { + Version = Version.Parse(version); + } + + public Version Version { get; set; } +} \ No newline at end of file diff --git a/Blog.Core.Migrate/Blog.Core.Migrate.csproj b/Blog.Core.Migrate/Blog.Core.Migrate.csproj new file mode 100644 index 00000000..54273772 --- /dev/null +++ b/Blog.Core.Migrate/Blog.Core.Migrate.csproj @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/Blog.Core.Migrate/Core/IMigrate.cs b/Blog.Core.Migrate/Core/IMigrate.cs new file mode 100644 index 00000000..36f461e2 --- /dev/null +++ b/Blog.Core.Migrate/Core/IMigrate.cs @@ -0,0 +1,13 @@ +using SqlSugar; + +namespace Blog.Core.Migrate.Core; + +public interface IMigrate +{ + ISqlSugarClient Orm { get; set; } + string TableName { get; set; } + DbType DbType { get; set; } + Version Version { get; set; } + + void Execution(); +} \ No newline at end of file diff --git a/Blog.Core.Migrate/Core/MigrateCore.cs b/Blog.Core.Migrate/Core/MigrateCore.cs new file mode 100644 index 00000000..5334ca83 --- /dev/null +++ b/Blog.Core.Migrate/Core/MigrateCore.cs @@ -0,0 +1,99 @@ +using System.Reflection; +using Blog.Core.Migrate.Attributes; +using Serilog; +using SqlSugar; + +namespace Blog.Core.Migrate.Core; + +public static class MigrateCore +{ + private static async Task> GetTableVersionsAsync(ISqlSugarClient db) + { + if (!db.DbMaintenance.IsAnyTable(nameof(TableVersion))) db.CodeFirst.InitTables(typeof(TableVersion)); + return (await db.Queryable().ToListAsync()).ToDictionary(s => s.TableName, s => s.Version); + } + + public static MigrateVersionAttribute GetMigrateVersion() + { + return GetMigrateVersion(typeof(T)); + } + + public static MigrateVersionAttribute GetMigrateVersion(Type type) + { + return type.GetCustomAttribute(); + } + + public static bool IsSplitTable(Type type) + { + return type.GetCustomAttribute() != null; + } + + public static bool IsMigrate(Type type) + { + var ma = type.GetCustomAttribute(); + return ma == null || ma.Enable; + } + + public static void Migrate(ISqlSugarClient context, Type type) + { + if (!IsMigrate(type)) return; + + if (IsSplitTable(type)) + context.CodeFirst.SplitTables().InitTables(type); + else + context.CodeFirst.InitTables(type); + } + + public static async Task MigrateAsync(ISqlSugarClient context, IEnumerable types) + { + var oldVersions = await GetTableVersionsAsync(context); + + foreach (var type in types) + { + if (!IsMigrate(type)) continue; + + var version = GetMigrateVersion(type); + if (version == null) + { + //没有标记版本号的表 只会初始化 不会迁移 + //表不存在初始化 + if (!context.DbMaintenance.IsAnyTable(type.Name)) + { + Log.Logger.Information("Init Table:{TableName}", type.Name); + Migrate(context, type); + } + continue; + } + + var tableName = context.MappingTables.FirstOrDefault(s => s.EntityName == type.Name)?.DbTableName; + if (string.IsNullOrWhiteSpace(tableName)) + { + tableName = context.EntityMaintenance.GetEntityInfo(type).DbTableName; + } + + var ver = oldVersions.GetValueOrDefault(tableName); + if (ver != null) + { + var oldVersion = new Version(ver); + if (oldVersion >= version.Version) continue; + } + + Log.Logger.Information("Modify Table:{TableName} oldVersion:{Ver} newVersion:{NewVersion}", + tableName, ver, version.Version); + Migrate(context, type); + + if (ver == null) + await context.Insertable(new TableVersion + { + TableName = tableName, + Version = version.Version.ToString() + }).ExecuteCommandAsync(); + else + await context.Updateable(new TableVersion + { + TableName = tableName, + Version = version.Version.ToString() + }).ExecuteCommandAsync(); + } + } +} \ No newline at end of file diff --git a/Blog.Core.Migrate/Core/TableVersion.cs b/Blog.Core.Migrate/Core/TableVersion.cs new file mode 100644 index 00000000..888a4595 --- /dev/null +++ b/Blog.Core.Migrate/Core/TableVersion.cs @@ -0,0 +1,18 @@ +using SqlSugar; + +namespace Blog.Core.Migrate.Core; + +/// +/// 数据表版本 +/// +public class TableVersion +{ + /// + /// 表名称 + /// + [SugarColumn(Length = 128, IsPrimaryKey = true)] + public string TableName { get; set; } + + [SugarColumn(Length = 50)] + public string Version { get; set; } +} \ No newline at end of file diff --git a/Blog.Core.Model/Base/BaseLog.cs b/Blog.Core.Model/Base/BaseLog.cs index 829ff09e..bce8bffa 100644 --- a/Blog.Core.Model/Base/BaseLog.cs +++ b/Blog.Core.Model/Base/BaseLog.cs @@ -1,7 +1,4 @@ -using SqlSugar; -using System; - -namespace Blog.Core.Model.Base; +namespace Blog.Core.Model.Base; public abstract class BaseLog : RootEntityTkey { diff --git a/Blog.Core.Model/Models/RootTkey/BaseEntity.cs b/Blog.Core.Model/Base/RootTkey/BaseEntity.cs similarity index 93% rename from Blog.Core.Model/Models/RootTkey/BaseEntity.cs rename to Blog.Core.Model/Base/RootTkey/BaseEntity.cs index 5d5d4414..b120bcd9 100644 --- a/Blog.Core.Model/Models/RootTkey/BaseEntity.cs +++ b/Blog.Core.Model/Base/RootTkey/BaseEntity.cs @@ -1,8 +1,6 @@ -using Blog.Core.Model.Models.RootTkey.Interface; -using SqlSugar; -using System; +using Blog.Core.Model.Base.RootTkey.Interface; -namespace Blog.Core.Model.Models.RootTkey; +namespace Blog.Core.Model.Base.RootTkey; [SugarIndex("index_{table}_Enabled", nameof(Enabled), OrderByType.Asc)] [SugarIndex("index_{table}_IsDeleted", nameof(IsDeleted), OrderByType.Asc)] diff --git a/Blog.Core.Model/Models/RootTkey/DepartmentRoot.cs b/Blog.Core.Model/Base/RootTkey/DepartmentRoot.cs similarity index 80% rename from Blog.Core.Model/Models/RootTkey/DepartmentRoot.cs rename to Blog.Core.Model/Base/RootTkey/DepartmentRoot.cs index ab10c9f8..df99de59 100644 --- a/Blog.Core.Model/Models/RootTkey/DepartmentRoot.cs +++ b/Blog.Core.Model/Base/RootTkey/DepartmentRoot.cs @@ -1,8 +1,4 @@ -using SqlSugar; -using System; -using System.Collections.Generic; - -namespace Blog.Core.Model +namespace Blog.Core.Model.Base.RootTkey { /// /// 部门表 diff --git a/Blog.Core.Model/Models/RootTkey/Interface/IDeleteFilter.cs b/Blog.Core.Model/Base/RootTkey/Interface/IDeleteFilter.cs similarity index 69% rename from Blog.Core.Model/Models/RootTkey/Interface/IDeleteFilter.cs rename to Blog.Core.Model/Base/RootTkey/Interface/IDeleteFilter.cs index 57d421e9..66011658 100644 --- a/Blog.Core.Model/Models/RootTkey/Interface/IDeleteFilter.cs +++ b/Blog.Core.Model/Base/RootTkey/Interface/IDeleteFilter.cs @@ -1,4 +1,4 @@ -namespace Blog.Core.Model.Models.RootTkey.Interface; +namespace Blog.Core.Model.Base.RootTkey.Interface; /// /// 软删除 过滤器 diff --git a/Blog.Core.Model/Models/RootTkey/ModulesRoot.cs b/Blog.Core.Model/Base/RootTkey/ModulesRoot.cs similarity index 85% rename from Blog.Core.Model/Models/RootTkey/ModulesRoot.cs rename to Blog.Core.Model/Base/RootTkey/ModulesRoot.cs index 64d2eef4..8f5c1270 100644 --- a/Blog.Core.Model/Models/RootTkey/ModulesRoot.cs +++ b/Blog.Core.Model/Base/RootTkey/ModulesRoot.cs @@ -1,7 +1,4 @@ -using SqlSugar; -using System; - -namespace Blog.Core.Model +namespace Blog.Core.Model.Base.RootTkey { /// /// 接口API地址信息表 diff --git a/Blog.Core.Model/Models/RootTkey/PermissionRoot.cs b/Blog.Core.Model/Base/RootTkey/PermissionRoot.cs similarity index 84% rename from Blog.Core.Model/Models/RootTkey/PermissionRoot.cs rename to Blog.Core.Model/Base/RootTkey/PermissionRoot.cs index a001b99f..55754505 100644 --- a/Blog.Core.Model/Models/RootTkey/PermissionRoot.cs +++ b/Blog.Core.Model/Base/RootTkey/PermissionRoot.cs @@ -1,8 +1,4 @@ -using SqlSugar; -using System; -using System.Collections.Generic; - -namespace Blog.Core.Model +namespace Blog.Core.Model.Base.RootTkey { /// /// 路由菜单表 diff --git a/Blog.Core.Model/Models/RootTkey/RoleModulePermissionRoot.cs b/Blog.Core.Model/Base/RootTkey/RoleModulePermissionRoot.cs similarity index 90% rename from Blog.Core.Model/Models/RootTkey/RoleModulePermissionRoot.cs rename to Blog.Core.Model/Base/RootTkey/RoleModulePermissionRoot.cs index 72c4e3d8..024cd03f 100644 --- a/Blog.Core.Model/Models/RootTkey/RoleModulePermissionRoot.cs +++ b/Blog.Core.Model/Base/RootTkey/RoleModulePermissionRoot.cs @@ -1,7 +1,4 @@ -using SqlSugar; -using System; - -namespace Blog.Core.Model +namespace Blog.Core.Model.Base.RootTkey { /// /// 按钮跟权限关联表 diff --git a/Blog.Core.Model/Models/RootTkey/RootEntityTkey.cs b/Blog.Core.Model/Base/RootTkey/RootEntityTkey.cs similarity index 81% rename from Blog.Core.Model/Models/RootTkey/RootEntityTkey.cs rename to Blog.Core.Model/Base/RootTkey/RootEntityTkey.cs index 20bdda0d..de8f802c 100644 --- a/Blog.Core.Model/Models/RootTkey/RootEntityTkey.cs +++ b/Blog.Core.Model/Base/RootTkey/RootEntityTkey.cs @@ -1,7 +1,4 @@ -using SqlSugar; -using System; - -namespace Blog.Core.Model +namespace Blog.Core.Model.Base.RootTkey { public class RootEntityTkey where Tkey : IEquatable { diff --git a/Blog.Core.Model/Models/RootTkey/TopicDetailRoot.cs b/Blog.Core.Model/Base/RootTkey/TopicDetailRoot.cs similarity index 82% rename from Blog.Core.Model/Models/RootTkey/TopicDetailRoot.cs rename to Blog.Core.Model/Base/RootTkey/TopicDetailRoot.cs index 8ae42152..6df85d9d 100644 --- a/Blog.Core.Model/Models/RootTkey/TopicDetailRoot.cs +++ b/Blog.Core.Model/Base/RootTkey/TopicDetailRoot.cs @@ -1,6 +1,4 @@ -using System; - -namespace Blog.Core.Model +namespace Blog.Core.Model.Base.RootTkey { /// /// Tibug 博文 diff --git a/Blog.Core.Model/Models/RootTkey/UserRoleRoot.cs b/Blog.Core.Model/Base/RootTkey/UserRoleRoot.cs similarity index 90% rename from Blog.Core.Model/Models/RootTkey/UserRoleRoot.cs rename to Blog.Core.Model/Base/RootTkey/UserRoleRoot.cs index f4cd4a58..bb968c7f 100644 --- a/Blog.Core.Model/Models/RootTkey/UserRoleRoot.cs +++ b/Blog.Core.Model/Base/RootTkey/UserRoleRoot.cs @@ -1,6 +1,4 @@ -using System; - -namespace Blog.Core.Model +namespace Blog.Core.Model.Base.RootTkey { /// /// 用户跟角色关联表 diff --git a/Blog.Core.Model/Models/RootTkey/sysUserInfoRoot.cs b/Blog.Core.Model/Base/RootTkey/sysUserInfoRoot.cs similarity index 81% rename from Blog.Core.Model/Models/RootTkey/sysUserInfoRoot.cs rename to Blog.Core.Model/Base/RootTkey/sysUserInfoRoot.cs index 60531b1c..3ce4a2d9 100644 --- a/Blog.Core.Model/Models/RootTkey/sysUserInfoRoot.cs +++ b/Blog.Core.Model/Base/RootTkey/sysUserInfoRoot.cs @@ -1,8 +1,4 @@ -using SqlSugar; -using System; -using System.Collections.Generic; - -namespace Blog.Core.Model +namespace Blog.Core.Model.Base.RootTkey { /// /// 用户信息表 diff --git a/Blog.Core.Model/Tenants/ITenantEntity.cs b/Blog.Core.Model/Base/Tenants/ITenantEntity.cs similarity index 79% rename from Blog.Core.Model/Tenants/ITenantEntity.cs rename to Blog.Core.Model/Base/Tenants/ITenantEntity.cs index 2d0c5dc9..f6f05bd9 100644 --- a/Blog.Core.Model/Tenants/ITenantEntity.cs +++ b/Blog.Core.Model/Base/Tenants/ITenantEntity.cs @@ -1,6 +1,4 @@ -using SqlSugar; - -namespace Blog.Core.Model.Tenants; +namespace Blog.Core.Model.Base.Tenants; /// /// 租户模型接口 diff --git a/Blog.Core.Model/Tenants/MultiTenantAttribute.cs b/Blog.Core.Model/Base/Tenants/MultiTenantAttribute.cs similarity index 90% rename from Blog.Core.Model/Tenants/MultiTenantAttribute.cs rename to Blog.Core.Model/Base/Tenants/MultiTenantAttribute.cs index 443745bf..887a43bc 100644 --- a/Blog.Core.Model/Tenants/MultiTenantAttribute.cs +++ b/Blog.Core.Model/Base/Tenants/MultiTenantAttribute.cs @@ -1,6 +1,4 @@ -using System; - -namespace Blog.Core.Model.Tenants; +namespace Blog.Core.Model.Base.Tenants; /// /// 标识 多租户 的业务表
diff --git a/Blog.Core.Model/Tenants/TenantTypeEnum.cs b/Blog.Core.Model/Base/Tenants/TenantTypeEnum.cs similarity index 91% rename from Blog.Core.Model/Tenants/TenantTypeEnum.cs rename to Blog.Core.Model/Base/Tenants/TenantTypeEnum.cs index f4af3bda..aa30e8c2 100644 --- a/Blog.Core.Model/Tenants/TenantTypeEnum.cs +++ b/Blog.Core.Model/Base/Tenants/TenantTypeEnum.cs @@ -1,6 +1,6 @@ using System.ComponentModel; -namespace Blog.Core.Model.Tenants; +namespace Blog.Core.Model.Base.Tenants; /// /// 租户隔离方案 diff --git a/Blog.Core.Model/Blog.Core.Model.csproj b/Blog.Core.Model/Blog.Core.Model.csproj index fb04c45c..9ea45849 100644 --- a/Blog.Core.Model/Blog.Core.Model.csproj +++ b/Blog.Core.Model/Blog.Core.Model.csproj @@ -19,7 +19,7 @@ - + diff --git a/Blog.Core.Model/CustomEnums/AuthorityScopeEnum.cs b/Blog.Core.Model/CustomEnums/AuthorityScopeEnum.cs index 422b2c56..d6632b54 100644 --- a/Blog.Core.Model/CustomEnums/AuthorityScopeEnum.cs +++ b/Blog.Core.Model/CustomEnums/AuthorityScopeEnum.cs @@ -1,4 +1,4 @@ -namespace Blog.Core.Model +namespace Blog.Core.Model.CustomEnums { public enum AuthorityScopeEnum { diff --git a/Blog.Core.Model/GlobalUsings.cs b/Blog.Core.Model/GlobalUsings.cs new file mode 100644 index 00000000..55069d54 --- /dev/null +++ b/Blog.Core.Model/GlobalUsings.cs @@ -0,0 +1,9 @@ +// global using 指令 + +global using System; +global using System.Collections.Generic; +global using System.Text; +global using Blog.Core.Migrate.Attributes; +global using Blog.Core.Model.Base; +global using Blog.Core.Model.Base.RootTkey; +global using SqlSugar; \ No newline at end of file diff --git a/Blog.Core.Model/HttpEnum.cs b/Blog.Core.Model/HttpEnum.cs index 05e25582..e5ef4b3a 100644 --- a/Blog.Core.Model/HttpEnum.cs +++ b/Blog.Core.Model/HttpEnum.cs @@ -1,6 +1,4 @@ -using System; - -namespace Blog.Core.Model +namespace Blog.Core.Model { public enum HttpEnum { diff --git a/Blog.Core.Model/IDS4DbModels/ApplicationRole.cs b/Blog.Core.Model/IDS4DbModels/ApplicationRole.cs index 8baf76ea..420f3275 100644 --- a/Blog.Core.Model/IDS4DbModels/ApplicationRole.cs +++ b/Blog.Core.Model/IDS4DbModels/ApplicationRole.cs @@ -1,7 +1,4 @@ -using SqlSugar; -using System; - -namespace Blog.Core.Model.IDS4DbModels +namespace Blog.Core.Model.IDS4DbModels { /// /// 以下model 来自ids4项目,多库模式,为了调取ids4数据 diff --git a/Blog.Core.Model/IDS4DbModels/ApplicationUser.cs b/Blog.Core.Model/IDS4DbModels/ApplicationUser.cs index 50529166..d53b9078 100644 --- a/Blog.Core.Model/IDS4DbModels/ApplicationUser.cs +++ b/Blog.Core.Model/IDS4DbModels/ApplicationUser.cs @@ -1,7 +1,4 @@ -using SqlSugar; -using System; - -namespace Blog.Core.Model.IDS4DbModels +namespace Blog.Core.Model.IDS4DbModels { /// /// 以下model 来自ids4项目,多库模式,为了调取ids4数据 diff --git a/Blog.Core.Model/Logs/AuditSqlLog.cs b/Blog.Core.Model/Logs/AuditSqlLog.cs index f4b28195..4e17956f 100644 --- a/Blog.Core.Model/Logs/AuditSqlLog.cs +++ b/Blog.Core.Model/Logs/AuditSqlLog.cs @@ -1,11 +1,9 @@ -using Blog.Core.Model.Base; -using SqlSugar; - -namespace Blog.Core.Model.Logs; +namespace Blog.Core.Model.Logs; [Tenant("log")] [SplitTable(SplitType.Month)] //按月分表 (自带分表支持 年、季、月、周、日) [SugarTable($@"{nameof(AuditSqlLog)}_{{year}}{{month}}{{day}}")] +[MigrateVersion("1.0.0")] public class AuditSqlLog: BaseLog { diff --git a/Blog.Core.Model/Logs/GlobalErrorLog.cs b/Blog.Core.Model/Logs/GlobalErrorLog.cs index cea55642..63efbd95 100644 --- a/Blog.Core.Model/Logs/GlobalErrorLog.cs +++ b/Blog.Core.Model/Logs/GlobalErrorLog.cs @@ -1,11 +1,9 @@ -using Blog.Core.Model.Base; -using SqlSugar; - -namespace Blog.Core.Model.Logs; +namespace Blog.Core.Model.Logs; [Tenant("log")] [SplitTable(SplitType.Month)] //按月分表 (自带分表支持 年、季、月、周、日) [SugarTable($@"{nameof(GlobalErrorLog)}_{{year}}{{month}}{{day}}")] +[MigrateVersion("1.0.0")] public class GlobalErrorLog : BaseLog { [SugarColumn(IsNullable = true, ColumnDataType = "longtext,text,clob")] diff --git a/Blog.Core.Model/Logs/GlobalInformationLog.cs b/Blog.Core.Model/Logs/GlobalInformationLog.cs index 9e627acb..147ea3ea 100644 --- a/Blog.Core.Model/Logs/GlobalInformationLog.cs +++ b/Blog.Core.Model/Logs/GlobalInformationLog.cs @@ -1,11 +1,9 @@ -using Blog.Core.Model.Base; -using SqlSugar; - -namespace Blog.Core.Model.Logs; +namespace Blog.Core.Model.Logs; [Tenant("log")] [SplitTable(SplitType.Month)] //按月分表 (自带分表支持 年、季、月、周、日) [SugarTable($@"{nameof(GlobalInformationLog)}_{{year}}{{month}}{{day}}")] +[MigrateVersion("1.0.0")] public class GlobalInformationLog : BaseLog { diff --git a/Blog.Core.Model/Logs/GlobalWarningLog.cs b/Blog.Core.Model/Logs/GlobalWarningLog.cs index 36d8545e..9403b7ce 100644 --- a/Blog.Core.Model/Logs/GlobalWarningLog.cs +++ b/Blog.Core.Model/Logs/GlobalWarningLog.cs @@ -1,11 +1,9 @@ -using Blog.Core.Model.Base; -using SqlSugar; - -namespace Blog.Core.Model.Logs; +namespace Blog.Core.Model.Logs; [Tenant("log")] [SplitTable(SplitType.Month)] //按月分表 (自带分表支持 年、季、月、周、日) [SugarTable($@"{nameof(GlobalWarningLog)}_{{year}}{{month}}{{day}}")] +[MigrateVersion("1.0.0")] public class GlobalWarningLog: BaseLog { diff --git a/Blog.Core.Model/Models/AccessTrendLog.cs b/Blog.Core.Model/Models/AccessTrendLog.cs index bc4848cf..0a9e5446 100644 --- a/Blog.Core.Model/Models/AccessTrendLog.cs +++ b/Blog.Core.Model/Models/AccessTrendLog.cs @@ -1,11 +1,9 @@ -using SqlSugar; -using System; - -namespace Blog.Core.Model.Models +namespace Blog.Core.Model.Models { /// /// 用户访问趋势日志 /// + [MigrateVersion("1.0.0")] public class AccessTrendLog : RootEntityTkey { /// diff --git a/Blog.Core.Model/Models/Advertisement.cs b/Blog.Core.Model/Models/Advertisement.cs index 3b11b21f..fb6b7fe8 100644 --- a/Blog.Core.Model/Models/Advertisement.cs +++ b/Blog.Core.Model/Models/Advertisement.cs @@ -1,8 +1,6 @@ -using SqlSugar; -using System; - -namespace Blog.Core.Model.Models +namespace Blog.Core.Model.Models { + [MigrateVersion("1.0.0")] public class Advertisement : RootEntityTkey { diff --git a/Blog.Core.Model/Models/BlogArticle.cs b/Blog.Core.Model/Models/BlogArticle.cs index 8b75c8df..c1d839b9 100644 --- a/Blog.Core.Model/Models/BlogArticle.cs +++ b/Blog.Core.Model/Models/BlogArticle.cs @@ -1,12 +1,9 @@ -using SqlSugar; -using System; -using System.Collections.Generic; - -namespace Blog.Core.Model.Models +namespace Blog.Core.Model.Models { /// /// 博客文章 /// + [MigrateVersion("1.0.0")] public class BlogArticle { /// diff --git a/Blog.Core.Model/Models/BlogArticleComment.cs b/Blog.Core.Model/Models/BlogArticleComment.cs index 519fb003..8464d286 100644 --- a/Blog.Core.Model/Models/BlogArticleComment.cs +++ b/Blog.Core.Model/Models/BlogArticleComment.cs @@ -1,10 +1,9 @@ -using SqlSugar; - -namespace Blog.Core.Model.Models; +namespace Blog.Core.Model.Models; /// /// 博客文章 评论 /// +[MigrateVersion("1.0.0")] public class BlogArticleComment : RootEntityTkey { public long bID { get; set; } diff --git a/Blog.Core.Model/Models/Department.cs b/Blog.Core.Model/Models/Department.cs index 424bcf44..d91e9ae6 100644 --- a/Blog.Core.Model/Models/Department.cs +++ b/Blog.Core.Model/Models/Department.cs @@ -1,12 +1,9 @@ -using SqlSugar; -using System; - - -namespace Blog.Core.Model.Models +namespace Blog.Core.Model.Models { /// /// 部门表 /// + [MigrateVersion("1.0.0")] public class Department : DepartmentRoot { /// diff --git a/Blog.Core.Model/Models/GblLogAudit.cs b/Blog.Core.Model/Models/GblLogAudit.cs index d4a85411..b203a467 100644 --- a/Blog.Core.Model/Models/GblLogAudit.cs +++ b/Blog.Core.Model/Models/GblLogAudit.cs @@ -1,12 +1,10 @@ -using SqlSugar; -using System; - -namespace Blog.Core.Model.Models +namespace Blog.Core.Model.Models { /// /// 用户团队表 /// [SugarTable("GblLogAudit", TableDescription = "日志审计")] + [MigrateVersion("1.0.0")] public class GblLogAudit { /// diff --git a/Blog.Core.Model/Models/Guestbook.cs b/Blog.Core.Model/Models/Guestbook.cs index 0cd5dcef..429fc085 100644 --- a/Blog.Core.Model/Models/Guestbook.cs +++ b/Blog.Core.Model/Models/Guestbook.cs @@ -1,8 +1,6 @@ -using SqlSugar; -using System; - -namespace Blog.Core.Model.Models +namespace Blog.Core.Model.Models { + [MigrateVersion("1.0.0")] public class Guestbook : RootEntityTkey { diff --git a/Blog.Core.Model/Models/Modules.cs b/Blog.Core.Model/Models/Modules.cs index 684cfcd0..a986b5d0 100644 --- a/Blog.Core.Model/Models/Modules.cs +++ b/Blog.Core.Model/Models/Modules.cs @@ -1,11 +1,9 @@ -using SqlSugar; -using System; - -namespace Blog.Core.Model.Models +namespace Blog.Core.Model.Models { /// /// 接口API地址信息表 /// + [MigrateVersion("1.0.0")] public class Modules : ModulesRoot { public Modules() diff --git a/Blog.Core.Model/Models/OperateLog.cs b/Blog.Core.Model/Models/OperateLog.cs index 3c2fb54c..8f509f50 100644 --- a/Blog.Core.Model/Models/OperateLog.cs +++ b/Blog.Core.Model/Models/OperateLog.cs @@ -1,11 +1,9 @@ -using SqlSugar; -using System; - -namespace Blog.Core.Model.Models +namespace Blog.Core.Model.Models { /// /// 日志记录 /// + [MigrateVersion("1.0.0")] public class OperateLog : RootEntityTkey { diff --git a/Blog.Core.Model/Models/PasswordLib.cs b/Blog.Core.Model/Models/PasswordLib.cs index 2037df4d..6bbdf491 100644 --- a/Blog.Core.Model/Models/PasswordLib.cs +++ b/Blog.Core.Model/Models/PasswordLib.cs @@ -1,13 +1,11 @@ -using SqlSugar; -using System; - -namespace Blog.Core.Model.Models +namespace Blog.Core.Model.Models { /// /// 密码库表 /// [SugarTable("PasswordLib", "密码库表")]//('数据库表名','数据库表备注') //[TenantAttribute("WMBLOG_MYSQL_2")] //('代表是哪个数据库,名字是appsettings.json 的 ConnId') + [MigrateVersion("1.0.0")] public class PasswordLib { [SugarColumn(IsNullable = false, IsPrimaryKey = true, IsIdentity = false)] diff --git a/Blog.Core.Model/Models/Permission.cs b/Blog.Core.Model/Models/Permission.cs index 95a46b85..b41e555d 100644 --- a/Blog.Core.Model/Models/Permission.cs +++ b/Blog.Core.Model/Models/Permission.cs @@ -1,12 +1,9 @@ -using SqlSugar; -using System; -using System.Collections.Generic; - -namespace Blog.Core.Model.Models +namespace Blog.Core.Model.Models { /// /// 路由菜单表 /// + [MigrateVersion("1.0.0")] public class Permission : PermissionRoot { public Permission() diff --git a/Blog.Core.Model/Models/Role.cs b/Blog.Core.Model/Models/Role.cs index 0e65bcaf..993c7043 100644 --- a/Blog.Core.Model/Models/Role.cs +++ b/Blog.Core.Model/Models/Role.cs @@ -1,11 +1,9 @@ -using SqlSugar; -using System; - -namespace Blog.Core.Model.Models +namespace Blog.Core.Model.Models { /// /// 角色表 /// + [MigrateVersion("1.0.0")] public class Role : RootEntityTkey { public Role() diff --git a/Blog.Core.Model/Models/RoleModulePermission.cs b/Blog.Core.Model/Models/RoleModulePermission.cs index f33c1080..38c2535f 100644 --- a/Blog.Core.Model/Models/RoleModulePermission.cs +++ b/Blog.Core.Model/Models/RoleModulePermission.cs @@ -1,11 +1,9 @@ -using SqlSugar; -using System; - -namespace Blog.Core.Model.Models +namespace Blog.Core.Model.Models { /// /// 按钮跟权限关联表 /// + [MigrateVersion("1.0.0")] public class RoleModulePermission : RoleModulePermissionRoot { public RoleModulePermission() diff --git a/Blog.Core.Model/Models/SplitDemo.cs b/Blog.Core.Model/Models/SplitDemo.cs index 75154038..e1124957 100644 --- a/Blog.Core.Model/Models/SplitDemo.cs +++ b/Blog.Core.Model/Models/SplitDemo.cs @@ -1,9 +1,5 @@ using Newtonsoft.Json; -using SqlSugar; -using System; -using System.Collections.Generic; using System.Linq; -using System.Text; using System.Text.Json.Serialization; using System.Threading.Tasks; @@ -11,6 +7,7 @@ namespace Blog.Core.Model.Models { [SplitTable(SplitType.Day)]//按天分表 (自带分表支持 年、季、月、周、日) [SugarTable("SplitDemo_{year}{month}{day}")]//3个变量必须要有,这么设计为了兼容开始按年,后面改成按月、按日 + [MigrateVersion("1.0.0")] public class SplitDemo { [SugarColumn(IsPrimaryKey = true)] diff --git a/Blog.Core.Model/Models/SysTenant.cs b/Blog.Core.Model/Models/SysTenant.cs index 61d03866..7fc395b9 100644 --- a/Blog.Core.Model/Models/SysTenant.cs +++ b/Blog.Core.Model/Models/SysTenant.cs @@ -1,5 +1,4 @@ -using Blog.Core.Model.Tenants; -using SqlSugar; +using Blog.Core.Model.Base.Tenants; namespace Blog.Core.Model.Models; @@ -14,6 +13,7 @@ namespace Blog.Core.Model.Models; /// 注意:
/// 使用租户Id方案,无需配置分库的连接 ///
+[MigrateVersion("1.0.0")] public class SysTenant : RootEntityTkey { /// diff --git a/Blog.Core.Model/Models/TasksLog.cs b/Blog.Core.Model/Models/TasksLog.cs index c79e8077..2234cf49 100644 --- a/Blog.Core.Model/Models/TasksLog.cs +++ b/Blog.Core.Model/Models/TasksLog.cs @@ -1,11 +1,9 @@ -using SqlSugar; -using System; - -namespace Blog.Core.Model.Models +namespace Blog.Core.Model.Models { /// /// 任务日志表 /// + [MigrateVersion("1.0.0")] public class TasksLog : RootEntityTkey { /// diff --git a/Blog.Core.Model/Models/TasksQz.cs b/Blog.Core.Model/Models/TasksQz.cs index b029a995..89283adb 100644 --- a/Blog.Core.Model/Models/TasksQz.cs +++ b/Blog.Core.Model/Models/TasksQz.cs @@ -1,13 +1,11 @@ using Blog.Core.Model.ViewModels; -using SqlSugar; -using System; -using System.Collections.Generic; namespace Blog.Core.Model.Models { /// /// 任务计划表 /// + [MigrateVersion("1.0.0")] public class TasksQz : RootEntityTkey { /// diff --git a/Blog.Core.Model/Models/Tenant/BusinessTable.cs b/Blog.Core.Model/Models/Tenant/BusinessTable.cs index b3b0140a..eed33697 100644 --- a/Blog.Core.Model/Models/Tenant/BusinessTable.cs +++ b/Blog.Core.Model/Models/Tenant/BusinessTable.cs @@ -1,12 +1,12 @@ -using Blog.Core.Model.Models.RootTkey; -using Blog.Core.Model.Tenants; +using Blog.Core.Model.Base.Tenants; -namespace Blog.Core.Model.Models; +namespace Blog.Core.Model.Models.Tenant; /// /// 业务数据
/// 多租户 (Id 隔离) ///
+[MigrateVersion("1.0.0")] public class BusinessTable : BaseEntity, ITenantEntity { /// diff --git a/Blog.Core.Model/Models/Tenant/MultiBusinessSubTable.cs b/Blog.Core.Model/Models/Tenant/MultiBusinessSubTable.cs index 1ada394d..707bdf20 100644 --- a/Blog.Core.Model/Models/Tenant/MultiBusinessSubTable.cs +++ b/Blog.Core.Model/Models/Tenant/MultiBusinessSubTable.cs @@ -1,12 +1,12 @@ -using Blog.Core.Model.Models.RootTkey; -using Blog.Core.Model.Tenants; +using Blog.Core.Model.Base.Tenants; -namespace Blog.Core.Model.Models; +namespace Blog.Core.Model.Models.Tenant; /// /// 多租户-多表方案 业务表 子表
///
[MultiTenant(TenantTypeEnum.Tables)] +[MigrateVersion("1.0.0")] public class MultiBusinessSubTable : BaseEntity { public long MainId { get; set; } diff --git a/Blog.Core.Model/Models/Tenant/MultiBusinessTable.cs b/Blog.Core.Model/Models/Tenant/MultiBusinessTable.cs index 619bdaaf..2709b25e 100644 --- a/Blog.Core.Model/Models/Tenant/MultiBusinessTable.cs +++ b/Blog.Core.Model/Models/Tenant/MultiBusinessTable.cs @@ -1,14 +1,12 @@ -using System.Collections.Generic; -using Blog.Core.Model.Models.RootTkey; -using Blog.Core.Model.Tenants; -using SqlSugar; +using Blog.Core.Model.Base.Tenants; -namespace Blog.Core.Model.Models; +namespace Blog.Core.Model.Models.Tenant; /// /// 多租户-多表方案 业务表
///
[MultiTenant(TenantTypeEnum.Tables)] +[MigrateVersion("1.0.1")] public class MultiBusinessTable : BaseEntity { /// @@ -21,6 +19,12 @@ public class MultiBusinessTable : BaseEntity /// public decimal Amount { get; set; } + /// + /// 备注(测试增加字段,多表迁移) + /// + [SugarColumn(IsNullable = true)] + public string Remark { get; set; } + [Navigate(NavigateType.OneToMany, nameof(MultiBusinessSubTable.MainId))] public List Child { get; set; } } \ No newline at end of file diff --git a/Blog.Core.Model/Models/Tenant/SubLibraryBusinessTable.cs b/Blog.Core.Model/Models/Tenant/SubLibraryBusinessTable.cs index 446fb436..82700dc4 100644 --- a/Blog.Core.Model/Models/Tenant/SubLibraryBusinessTable.cs +++ b/Blog.Core.Model/Models/Tenant/SubLibraryBusinessTable.cs @@ -1,13 +1,13 @@ -using Blog.Core.Model.Models.RootTkey; -using Blog.Core.Model.Tenants; +using Blog.Core.Model.Base.Tenants; -namespace Blog.Core.Model.Models; +namespace Blog.Core.Model.Models.Tenant; /// /// 多租户-多库方案 业务表
/// 公共库无需标记[MultiTenant]特性 ///
[MultiTenant] +[MigrateVersion("1.0.1")] public class SubLibraryBusinessTable : BaseEntity { /// @@ -19,4 +19,10 @@ public class SubLibraryBusinessTable : BaseEntity /// 金额 /// public decimal Amount { get; set; } + + /// + /// 备注(测试增加字段,多库迁移) + /// + [SugarColumn(IsNullable = true)] + public string Remark { get; set; } } \ No newline at end of file diff --git a/Blog.Core.Model/Models/TestModels.cs b/Blog.Core.Model/Models/TestModels.cs index 8a8d123c..ab487592 100644 --- a/Blog.Core.Model/Models/TestModels.cs +++ b/Blog.Core.Model/Models/TestModels.cs @@ -1,6 +1,6 @@ namespace Blog.Core.Model.Models { - + [MigrateVersion("1.0.0")] public class TestMuchTableResult { public string moduleName { get; set; } diff --git a/Blog.Core.Model/Models/Topic.cs b/Blog.Core.Model/Models/Topic.cs index e57bd561..7cf8b5ab 100644 --- a/Blog.Core.Model/Models/Topic.cs +++ b/Blog.Core.Model/Models/Topic.cs @@ -1,12 +1,9 @@ -using SqlSugar; -using System; -using System.Collections.Generic; - -namespace Blog.Core.Model.Models +namespace Blog.Core.Model.Models { /// /// Tibug 类别 /// + [MigrateVersion("1.0.0")] public class Topic : RootEntityTkey { public Topic() diff --git a/Blog.Core.Model/Models/TopicDetail.cs b/Blog.Core.Model/Models/TopicDetail.cs index 6cb69c67..8a8aaadf 100644 --- a/Blog.Core.Model/Models/TopicDetail.cs +++ b/Blog.Core.Model/Models/TopicDetail.cs @@ -1,11 +1,9 @@ -using SqlSugar; -using System; - -namespace Blog.Core.Model.Models +namespace Blog.Core.Model.Models { /// /// Tibug 博文 /// + [MigrateVersion("1.0.0")] public class TopicDetail : TopicDetailRoot { public TopicDetail() diff --git a/Blog.Core.Model/Models/UserRole.cs b/Blog.Core.Model/Models/UserRole.cs index 7ed9c6be..630ea5b5 100644 --- a/Blog.Core.Model/Models/UserRole.cs +++ b/Blog.Core.Model/Models/UserRole.cs @@ -1,11 +1,9 @@ -using SqlSugar; -using System; - -namespace Blog.Core.Model.Models +namespace Blog.Core.Model.Models { /// /// 用户跟角色关联表 /// + [MigrateVersion("1.0.0")] public class UserRole : UserRoleRoot { public UserRole() { } diff --git a/Blog.Core.Model/Models/WeChatCompany.cs b/Blog.Core.Model/Models/WeChatCompany.cs index d07d4208..ad2cbb14 100644 --- a/Blog.Core.Model/Models/WeChatCompany.cs +++ b/Blog.Core.Model/Models/WeChatCompany.cs @@ -1,7 +1,4 @@ -using System; -using System.Linq; -using System.Text; -using SqlSugar; +using System.Linq; namespace Blog.Core.Model.Models { @@ -9,6 +6,7 @@ namespace Blog.Core.Model.Models /// ///
[SugarTable("WeChatCompany")] + [MigrateVersion("1.0.0")] public partial class WeChatCompany { diff --git a/Blog.Core.Model/Models/WeChatConfig.cs b/Blog.Core.Model/Models/WeChatConfig.cs index 16910487..fd57335e 100644 --- a/Blog.Core.Model/Models/WeChatConfig.cs +++ b/Blog.Core.Model/Models/WeChatConfig.cs @@ -1,7 +1,4 @@ -using System; -using System.Linq; -using System.Text; -using SqlSugar; +using System.Linq; namespace Blog.Core.Model.Models { @@ -9,6 +6,7 @@ namespace Blog.Core.Model.Models /// ///
[SugarTable("WeChatConfig")] + [MigrateVersion("1.0.0")] public class WeChatConfig { diff --git a/Blog.Core.Model/Models/WeChatPushLog.cs b/Blog.Core.Model/Models/WeChatPushLog.cs index 5368c806..d47298d3 100644 --- a/Blog.Core.Model/Models/WeChatPushLog.cs +++ b/Blog.Core.Model/Models/WeChatPushLog.cs @@ -1,7 +1,4 @@ -using System; -using System.Linq; -using System.Text; -using SqlSugar; +using System.Linq; namespace Blog.Core.Model.Models { @@ -9,6 +6,7 @@ namespace Blog.Core.Model.Models /// ///
[SugarTable("WeChatPushLog")] + [MigrateVersion("1.0.0")] public partial class WeChatPushLog { diff --git a/Blog.Core.Model/Models/WeChatQR.cs b/Blog.Core.Model/Models/WeChatQR.cs index 06ea8684..8a1f73fe 100644 --- a/Blog.Core.Model/Models/WeChatQR.cs +++ b/Blog.Core.Model/Models/WeChatQR.cs @@ -1,7 +1,4 @@ -using System; -using System.Linq; -using System.Text; -using SqlSugar; +using System.Linq; namespace Blog.Core.Model.Models { @@ -9,6 +6,7 @@ namespace Blog.Core.Model.Models /// ///
[SugarTable("WeChatQR")] + [MigrateVersion("1.0.0")] public partial class WeChatQR { diff --git a/Blog.Core.Model/Models/WeChatSub.cs b/Blog.Core.Model/Models/WeChatSub.cs index 48787a5f..da9652e5 100644 --- a/Blog.Core.Model/Models/WeChatSub.cs +++ b/Blog.Core.Model/Models/WeChatSub.cs @@ -1,7 +1,4 @@ -using System; -using System.Linq; -using System.Text; -using SqlSugar; +using System.Linq; namespace Blog.Core.Model.Models { @@ -9,6 +6,7 @@ namespace Blog.Core.Model.Models /// ///
[SugarTable("WeChatSub")] + [MigrateVersion("1.0.0")] public partial class WeChatSub { [SugarColumn(IsNullable = false,IsPrimaryKey = true)] diff --git a/Blog.Core.Model/Models/WeChatUploadFile.cs b/Blog.Core.Model/Models/WeChatUploadFile.cs index f7b979de..8ebe1a7a 100644 --- a/Blog.Core.Model/Models/WeChatUploadFile.cs +++ b/Blog.Core.Model/Models/WeChatUploadFile.cs @@ -1,7 +1,4 @@ -using System; -using System.Linq; -using System.Text; -using SqlSugar; +using System.Linq; namespace Blog.Core.Model.Models { @@ -9,6 +6,7 @@ namespace Blog.Core.Model.Models /// ///
[SugarTable("WeChatUploadFile")] + [MigrateVersion("1.0.0")] public partial class WeChatUploadFile { diff --git a/Blog.Core.Model/Models/sysUserInfo.cs b/Blog.Core.Model/Models/sysUserInfo.cs index 1137d91c..2f54ecea 100644 --- a/Blog.Core.Model/Models/sysUserInfo.cs +++ b/Blog.Core.Model/Models/sysUserInfo.cs @@ -1,14 +1,11 @@ -using SqlSugar; -using System; -using System.Collections.Generic; - -namespace Blog.Core.Model.Models +namespace Blog.Core.Model.Models { /// /// 用户信息表 /// //[SugarTable("SysUserInfo")] [SugarTable("SysUserInfo", "用户表")] //('数据库表名','数据库表备注') + [MigrateVersion("1.0.0")] public class SysUserInfo : SysUserInfoRoot { public SysUserInfo() diff --git a/Blog.Core.Model/PageModel.cs b/Blog.Core.Model/PageModel.cs index f6872b66..589912b8 100644 --- a/Blog.Core.Model/PageModel.cs +++ b/Blog.Core.Model/PageModel.cs @@ -1,6 +1,4 @@ using AutoMapper; -using System; -using System.Collections.Generic; namespace Blog.Core.Model { diff --git a/Blog.Core.Model/Systems/DataBase/DatabaseOutput.cs b/Blog.Core.Model/Systems/DataBase/DatabaseOutput.cs index 8cefaeb6..7befc353 100644 --- a/Blog.Core.Model/Systems/DataBase/DatabaseOutput.cs +++ b/Blog.Core.Model/Systems/DataBase/DatabaseOutput.cs @@ -1,6 +1,4 @@ -using SqlSugar; - -namespace Blog.Core.Model.Systems.DataBase; +namespace Blog.Core.Model.Systems.DataBase; public class DatabaseOutput { diff --git a/Blog.Core.Model/TableModel.cs b/Blog.Core.Model/TableModel.cs index 289e9c8c..296f26e4 100644 --- a/Blog.Core.Model/TableModel.cs +++ b/Blog.Core.Model/TableModel.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; - -namespace Blog.Core.Model +namespace Blog.Core.Model { /// /// 表格数据,支持分页 diff --git a/Blog.Core.Model/ViewModels/AdvertisementViewModels.cs b/Blog.Core.Model/ViewModels/AdvertisementViewModels.cs index 81a1974a..1e6958dc 100644 --- a/Blog.Core.Model/ViewModels/AdvertisementViewModels.cs +++ b/Blog.Core.Model/ViewModels/AdvertisementViewModels.cs @@ -1,6 +1,4 @@ -using System; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { /// /// 广告类 diff --git a/Blog.Core.Model/ViewModels/BlogViewModels.cs b/Blog.Core.Model/ViewModels/BlogViewModels.cs index 86c16618..5cce99da 100644 --- a/Blog.Core.Model/ViewModels/BlogViewModels.cs +++ b/Blog.Core.Model/ViewModels/BlogViewModels.cs @@ -1,6 +1,4 @@ -using System; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { /// /// 博客信息展示类 diff --git a/Blog.Core.Model/ViewModels/EnumDemoDto.cs b/Blog.Core.Model/ViewModels/EnumDemoDto.cs index ae6ffbdd..c2a11c7d 100644 --- a/Blog.Core.Model/ViewModels/EnumDemoDto.cs +++ b/Blog.Core.Model/ViewModels/EnumDemoDto.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Linq; using System.Threading.Tasks; namespace Blog.Core.Model.ViewModels diff --git a/Blog.Core.Model/ViewModels/GuestbookViewModels.cs b/Blog.Core.Model/ViewModels/GuestbookViewModels.cs index 1729bdb4..0a03d5b7 100644 --- a/Blog.Core.Model/ViewModels/GuestbookViewModels.cs +++ b/Blog.Core.Model/ViewModels/GuestbookViewModels.cs @@ -1,5 +1,4 @@ -using System; -using Blog.Core.Model.Models; +using Blog.Core.Model.Models; namespace Blog.Core.Model.ViewModels { diff --git a/Blog.Core.Model/ViewModels/PayReturnResultModel.cs b/Blog.Core.Model/ViewModels/PayReturnResultModel.cs index 4cb8b624..db8c58b7 100644 --- a/Blog.Core.Model/ViewModels/PayReturnResultModel.cs +++ b/Blog.Core.Model/ViewModels/PayReturnResultModel.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using System.Linq; using System.Threading.Tasks; namespace Blog.Core.Model.ViewModels diff --git a/Blog.Core.Model/ViewModels/RootTKey/SysUserInfoDtoRoot.cs b/Blog.Core.Model/ViewModels/RootTKey/SysUserInfoDtoRoot.cs index bcccb8e7..260f5d9a 100644 --- a/Blog.Core.Model/ViewModels/RootTKey/SysUserInfoDtoRoot.cs +++ b/Blog.Core.Model/ViewModels/RootTKey/SysUserInfoDtoRoot.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels.RootTKey { public class SysUserInfoDtoRoot where Tkey : IEquatable { diff --git a/Blog.Core.Model/ViewModels/SidebarMenuViewModel.cs b/Blog.Core.Model/ViewModels/SidebarMenuViewModel.cs index d098f397..6c8ef6cd 100644 --- a/Blog.Core.Model/ViewModels/SidebarMenuViewModel.cs +++ b/Blog.Core.Model/ViewModels/SidebarMenuViewModel.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { /// /// 菜单展示model diff --git a/Blog.Core.Model/ViewModels/SysUserInfoDto.cs b/Blog.Core.Model/ViewModels/SysUserInfoDto.cs index 3b5451f0..28cdf030 100644 --- a/Blog.Core.Model/ViewModels/SysUserInfoDto.cs +++ b/Blog.Core.Model/ViewModels/SysUserInfoDto.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using Blog.Core.Model.ViewModels.RootTKey; namespace Blog.Core.Model.ViewModels { diff --git a/Blog.Core.Model/ViewModels/TaskInfoDto.cs b/Blog.Core.Model/ViewModels/TaskInfoDto.cs index 49b02085..164180f2 100644 --- a/Blog.Core.Model/ViewModels/TaskInfoDto.cs +++ b/Blog.Core.Model/ViewModels/TaskInfoDto.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { /// /// 调度任务触发器信息实体 diff --git a/Blog.Core.Model/ViewModels/WeChatApiDto.cs b/Blog.Core.Model/ViewModels/WeChatApiDto.cs index e02a55b1..846ff4a3 100644 --- a/Blog.Core.Model/ViewModels/WeChatApiDto.cs +++ b/Blog.Core.Model/ViewModels/WeChatApiDto.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { /// /// 微信接口消息DTO diff --git a/Blog.Core.Model/ViewModels/WeChatCardMsgDataDto.cs b/Blog.Core.Model/ViewModels/WeChatCardMsgDataDto.cs index 2448bdd4..d1c6c0df 100644 --- a/Blog.Core.Model/ViewModels/WeChatCardMsgDataDto.cs +++ b/Blog.Core.Model/ViewModels/WeChatCardMsgDataDto.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { /// /// 微信推送消息Dto diff --git a/Blog.Core.Model/ViewModels/WeChatCardMsgDataOpenIDDto.cs b/Blog.Core.Model/ViewModels/WeChatCardMsgDataOpenIDDto.cs index e90e5f47..62eb5ca9 100644 --- a/Blog.Core.Model/ViewModels/WeChatCardMsgDataOpenIDDto.cs +++ b/Blog.Core.Model/ViewModels/WeChatCardMsgDataOpenIDDto.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { /// /// 微信推送消息Dto diff --git a/Blog.Core.Model/ViewModels/WeChatCardMsgDetailDto.cs b/Blog.Core.Model/ViewModels/WeChatCardMsgDetailDto.cs index 17db8c91..a85b3739 100644 --- a/Blog.Core.Model/ViewModels/WeChatCardMsgDetailDto.cs +++ b/Blog.Core.Model/ViewModels/WeChatCardMsgDetailDto.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { /// /// 消息模板dto(如何填写数据,请参考微信模板即可) diff --git a/Blog.Core.Model/ViewModels/WeChatMenuButtonDto.cs b/Blog.Core.Model/ViewModels/WeChatMenuButtonDto.cs index df8952cd..2ade9d26 100644 --- a/Blog.Core.Model/ViewModels/WeChatMenuButtonDto.cs +++ b/Blog.Core.Model/ViewModels/WeChatMenuButtonDto.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { /// /// 获取微信菜单DTO,用于存放具体菜单内容 diff --git a/Blog.Core.Model/ViewModels/WeChatMenuDto.cs b/Blog.Core.Model/ViewModels/WeChatMenuDto.cs index 3015a2a7..462c0485 100644 --- a/Blog.Core.Model/ViewModels/WeChatMenuDto.cs +++ b/Blog.Core.Model/ViewModels/WeChatMenuDto.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { /// /// 获取微信菜单DTO diff --git a/Blog.Core.Model/ViewModels/WeChatOpenIDsDto.cs b/Blog.Core.Model/ViewModels/WeChatOpenIDsDto.cs index 93c13490..affe5d44 100644 --- a/Blog.Core.Model/ViewModels/WeChatOpenIDsDto.cs +++ b/Blog.Core.Model/ViewModels/WeChatOpenIDsDto.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { /// /// 微信OpenID列表Dto diff --git a/Blog.Core.Model/ViewModels/WeChatPushCardMsgDetailDto.cs b/Blog.Core.Model/ViewModels/WeChatPushCardMsgDetailDto.cs index b203dacb..aaeaa7b1 100644 --- a/Blog.Core.Model/ViewModels/WeChatPushCardMsgDetailDto.cs +++ b/Blog.Core.Model/ViewModels/WeChatPushCardMsgDetailDto.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { /// /// 推送详细数据 diff --git a/Blog.Core.Model/ViewModels/WeChatPushCardMsgDto.cs b/Blog.Core.Model/ViewModels/WeChatPushCardMsgDto.cs index 588ee09c..68ccd018 100644 --- a/Blog.Core.Model/ViewModels/WeChatPushCardMsgDto.cs +++ b/Blog.Core.Model/ViewModels/WeChatPushCardMsgDto.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { /// /// 推送给微信所需Dto diff --git a/Blog.Core.Model/ViewModels/WeChatPushCardMsgValueColorDto.cs b/Blog.Core.Model/ViewModels/WeChatPushCardMsgValueColorDto.cs index e9548fd8..97cfe516 100644 --- a/Blog.Core.Model/ViewModels/WeChatPushCardMsgValueColorDto.cs +++ b/Blog.Core.Model/ViewModels/WeChatPushCardMsgValueColorDto.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { /// /// 微信keyword所需Dto diff --git a/Blog.Core.Model/ViewModels/WeChatPushLinkMsgContentDto.cs b/Blog.Core.Model/ViewModels/WeChatPushLinkMsgContentDto.cs index 064eaab4..40192895 100644 --- a/Blog.Core.Model/ViewModels/WeChatPushLinkMsgContentDto.cs +++ b/Blog.Core.Model/ViewModels/WeChatPushLinkMsgContentDto.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { public class WeChatPushLinkMsgContentDto { diff --git a/Blog.Core.Model/ViewModels/WeChatPushPictureContentDto.cs b/Blog.Core.Model/ViewModels/WeChatPushPictureContentDto.cs index 3b29681a..f0d8b780 100644 --- a/Blog.Core.Model/ViewModels/WeChatPushPictureContentDto.cs +++ b/Blog.Core.Model/ViewModels/WeChatPushPictureContentDto.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { public class WeChatPushPictureContentDto { diff --git a/Blog.Core.Model/ViewModels/WeChatPushTestDto.cs b/Blog.Core.Model/ViewModels/WeChatPushTestDto.cs index a906fb80..f18d5cab 100644 --- a/Blog.Core.Model/ViewModels/WeChatPushTestDto.cs +++ b/Blog.Core.Model/ViewModels/WeChatPushTestDto.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { /// /// 推送模拟消息Dto diff --git a/Blog.Core.Model/ViewModels/WeChatPushTextContentDto.cs b/Blog.Core.Model/ViewModels/WeChatPushTextContentDto.cs index 55d6cc50..bc284cd4 100644 --- a/Blog.Core.Model/ViewModels/WeChatPushTextContentDto.cs +++ b/Blog.Core.Model/ViewModels/WeChatPushTextContentDto.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { public class WeChatPushTextContentDto { diff --git a/Blog.Core.Model/ViewModels/WeChatPushVideoContentDto.cs b/Blog.Core.Model/ViewModels/WeChatPushVideoContentDto.cs index a00ad6c1..02cd17e2 100644 --- a/Blog.Core.Model/ViewModels/WeChatPushVideoContentDto.cs +++ b/Blog.Core.Model/ViewModels/WeChatPushVideoContentDto.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { public class WeChatPushVideoContentDto { diff --git a/Blog.Core.Model/ViewModels/WeChatPushVoiceContentDto.cs b/Blog.Core.Model/ViewModels/WeChatPushVoiceContentDto.cs index 1a9da49f..6ad88549 100644 --- a/Blog.Core.Model/ViewModels/WeChatPushVoiceContentDto.cs +++ b/Blog.Core.Model/ViewModels/WeChatPushVoiceContentDto.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { public class WeChatPushVoiceContentDto { diff --git a/Blog.Core.Model/ViewModels/WeChatQRActionDto.cs b/Blog.Core.Model/ViewModels/WeChatQRActionDto.cs index 13001b6a..7d542d0a 100644 --- a/Blog.Core.Model/ViewModels/WeChatQRActionDto.cs +++ b/Blog.Core.Model/ViewModels/WeChatQRActionDto.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { /// /// 微信二维码预装发送信息dto diff --git a/Blog.Core.Model/ViewModels/WeChatQRActionInfoDto.cs b/Blog.Core.Model/ViewModels/WeChatQRActionInfoDto.cs index ba38072a..f61f8e33 100644 --- a/Blog.Core.Model/ViewModels/WeChatQRActionInfoDto.cs +++ b/Blog.Core.Model/ViewModels/WeChatQRActionInfoDto.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { /// /// 微信二维码预装具体消息 diff --git a/Blog.Core.Model/ViewModels/WeChatQRDto.cs b/Blog.Core.Model/ViewModels/WeChatQRDto.cs index eca876f3..b76c7325 100644 --- a/Blog.Core.Model/ViewModels/WeChatQRDto.cs +++ b/Blog.Core.Model/ViewModels/WeChatQRDto.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { /// /// 微信二维码预装信息DTO diff --git a/Blog.Core.Model/ViewModels/WeChatResponseUserInfo.cs b/Blog.Core.Model/ViewModels/WeChatResponseUserInfo.cs index 9d28fe51..ec1fd1e9 100644 --- a/Blog.Core.Model/ViewModels/WeChatResponseUserInfo.cs +++ b/Blog.Core.Model/ViewModels/WeChatResponseUserInfo.cs @@ -1,9 +1,4 @@ - -using System; -using System.Collections.Generic; -using System.Text; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { /// /// 返回给调用者的Dto diff --git a/Blog.Core.Model/ViewModels/WeChatUserInfo.cs b/Blog.Core.Model/ViewModels/WeChatUserInfo.cs index faf65b1d..3546e77a 100644 --- a/Blog.Core.Model/ViewModels/WeChatUserInfo.cs +++ b/Blog.Core.Model/ViewModels/WeChatUserInfo.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { /// /// 微信推送所需信息(公司版本) diff --git a/Blog.Core.Model/ViewModels/WeChatUserInfoOpenID.cs b/Blog.Core.Model/ViewModels/WeChatUserInfoOpenID.cs index ef01aad2..aad252f0 100644 --- a/Blog.Core.Model/ViewModels/WeChatUserInfoOpenID.cs +++ b/Blog.Core.Model/ViewModels/WeChatUserInfoOpenID.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Blog.Core.Model.ViewModels +namespace Blog.Core.Model.ViewModels { /// /// 微信推送所需信息(OpenID版本) diff --git a/Blog.Core.Model/ViewModels/WeChatValidDto.cs b/Blog.Core.Model/ViewModels/WeChatValidDto.cs index c0d038df..b61dd47b 100644 --- a/Blog.Core.Model/ViewModels/WeChatValidDto.cs +++ b/Blog.Core.Model/ViewModels/WeChatValidDto.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml.Serialization; +using System.Xml.Serialization; namespace Blog.Core.Model.ViewModels { diff --git a/Blog.Core.Model/ViewModels/WeChatXMLDto.cs b/Blog.Core.Model/ViewModels/WeChatXMLDto.cs index e293849d..b5370470 100644 --- a/Blog.Core.Model/ViewModels/WeChatXMLDto.cs +++ b/Blog.Core.Model/ViewModels/WeChatXMLDto.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Xml; +using System.Xml; using System.Xml.Serialization; namespace Blog.Core.Model.ViewModels diff --git a/Blog.Core.Repository/BASE/BaseRepository.cs b/Blog.Core.Repository/BASE/BaseRepository.cs index 3a1c1ee8..3aa47fa4 100644 --- a/Blog.Core.Repository/BASE/BaseRepository.cs +++ b/Blog.Core.Repository/BASE/BaseRepository.cs @@ -3,7 +3,6 @@ using Blog.Core.IRepository.Base; using Blog.Core.Model; using Blog.Core.Model.Models; -using Blog.Core.Model.Tenants; using Blog.Core.Repository.UnitOfWorks; using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; using SqlSugar; @@ -13,6 +12,7 @@ using System.Linq.Expressions; using System.Reflection; using System.Threading.Tasks; +using Blog.Core.Model.Base.Tenants; namespace Blog.Core.Repository.Base { diff --git a/Blog.Core.Services/PayServices.cs b/Blog.Core.Services/PayServices.cs index b257d088..3c1450fd 100644 --- a/Blog.Core.Services/PayServices.cs +++ b/Blog.Core.Services/PayServices.cs @@ -15,6 +15,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; +using Blog.Core.Model.Base.RootTkey; namespace Blog.Core.Services { diff --git a/Blog.Core.sln b/Blog.Core.sln index 8814184f..1ec192f7 100644 --- a/Blog.Core.sln +++ b/Blog.Core.sln @@ -60,6 +60,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ocelot.Provider.Nacos", "Oc EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blog.Core.Serilog", "Blog.Core.Serilog\Blog.Core.Serilog.csproj", "{7F9057F0-ED8D-4694-B590-7D75C012DF00}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Blog.Core.Migrate", "Blog.Core.Migrate\Blog.Core.Migrate.csproj", "{33CA9C84-5B1E-4783-9BA5-DE342575014C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -126,6 +128,10 @@ Global {7F9057F0-ED8D-4694-B590-7D75C012DF00}.Debug|Any CPU.Build.0 = Debug|Any CPU {7F9057F0-ED8D-4694-B590-7D75C012DF00}.Release|Any CPU.ActiveCfg = Release|Any CPU {7F9057F0-ED8D-4694-B590-7D75C012DF00}.Release|Any CPU.Build.0 = Release|Any CPU + {33CA9C84-5B1E-4783-9BA5-DE342575014C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {33CA9C84-5B1E-4783-9BA5-DE342575014C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {33CA9C84-5B1E-4783-9BA5-DE342575014C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {33CA9C84-5B1E-4783-9BA5-DE342575014C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Directory.Build.props b/Directory.Build.props index 2934ef7e..c3a65cdf 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,5 +2,6 @@ net8.0 enable + default \ No newline at end of file