Merge branch 'dev' of http://60.209.125.238:20010/chenjingyong/ds8-solution-pro into dev
commit
317ae49794
@ -0,0 +1,85 @@
|
||||
using System.Reflection;
|
||||
using DS.Module.Core;
|
||||
using DS.Module.Core.Extensions;
|
||||
using DS.Module.SqlSugar;
|
||||
using DS.WMS.Core.Check.Entity;
|
||||
using DS.WMS.Core.Code.Entity;
|
||||
using DS.WMS.Core.Info.Entity;
|
||||
using DS.WMS.Core.Op.Entity;
|
||||
using DS.WMS.Core.Op.Entity.BookingSlot;
|
||||
using DS.WMS.Core.Sys.Entity;
|
||||
using DS.WMS.Core.TaskPlat.Entity;
|
||||
using Mapster;
|
||||
using Masuit.Tools.Strings;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Owin.BuilderProperties;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Org.BouncyCastle.Ocsp;
|
||||
using SqlSugar;
|
||||
using SqlSugar.IOC;
|
||||
using Xunit;
|
||||
|
||||
namespace Ds.WMS.Test;
|
||||
|
||||
public class SaasDBUpdateTest
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly SqlSugarScope db;
|
||||
private readonly ISaasDbService saasService;
|
||||
public SaasDBUpdateTest(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
db = (SqlSugarScope)_serviceProvider.GetRequiredService<ISqlSugarClient>();
|
||||
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 主库初始化单表
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void MasterInitTableTest()
|
||||
{
|
||||
StaticConfig.CodeFirst_MySqlCollate = "utf8mb4_0900_ai_ci";//较高版本支持
|
||||
db.CodeFirst.InitTables(typeof(SysPrintTemplate));
|
||||
Assert.True(true);
|
||||
}
|
||||
/// <summary>
|
||||
/// 初始化单表 多表
|
||||
/// 注意 海运出口 SeaExport 得手动数据库更新
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void InitSaasTableTestByCjy()
|
||||
{
|
||||
var tenantList = db.Queryable<DS.Module.SqlSugar.SysTenantLink>().ToList();
|
||||
var ass = Assembly.Load("DS.WMS.Core");
|
||||
//var types = ass.GetTypes().Where(it => it.FullName?.Contains("DS.WMS.Core.TaskPlat.Entity") == true).ToArray();
|
||||
foreach (var item in tenantList)
|
||||
{
|
||||
var tenantDb = saasService.GetBizDbScopeById(item.TenantId).CopyNew();
|
||||
StaticConfig.CodeFirst_MySqlCollate = "utf8mb4_0900_ai_ci"; //较高版本支持
|
||||
//tenantDb.CodeFirst.InitTables(types); //指定表空间下的实体
|
||||
tenantDb.CodeFirst.InitTables(typeof(OpLetterYard));//指定更新特定实体
|
||||
}
|
||||
|
||||
Assert.True(true);
|
||||
}
|
||||
/// <summary>
|
||||
/// 初始化单表
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void InitTableTestZXF()
|
||||
{
|
||||
var tenantDb = saasService.GetBizDbScopeById("1750335377144680448");
|
||||
StaticConfig.CodeFirst_MySqlCollate = "utf8mb4_0900_ai_ci";//较高版本支持
|
||||
|
||||
var ass = Assembly.Load("DS.WMS.Core");
|
||||
var types = ass.GetTypes().Where(it => it.FullName?.Contains("DS.WMS.Core.TaskPlat.Entity") == true).ToArray();
|
||||
tenantDb.CodeFirst.InitTables(types);
|
||||
|
||||
//tenantDb.CodeFirst.InitTables(typeof(TaskFlowLog));
|
||||
//tenantDb.CodeFirst.InitTables(typeof(TaskFlowLogDetail));
|
||||
Assert.True(true);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue