Browse Source

租户数据修改

zhontai 2 years ago
parent
commit
4ee2978edc

+ 2 - 3
src/hosts/ZhonTai.Host/InitData/Admin/ad_tenant.json

@@ -10,9 +10,8 @@
     "roleId": 161223412080709,
     "tenantType": 1,
     "dbKey":  "masterdb",
-    "dbType": 4,
-    "connectionString": "Data Source=|DataDirectory|\\\\admindb.db; Pooling=true;Min Pool Size=1",
-    "idleTime": 10,
+    "dbType": "",
+    "connectionString": "",
     "enabled": true,
     "description": ""
   }

+ 4 - 4
src/platform/ZhonTai.Admin/Core/Db/Transaction/TransactionAsyncInterceptor.cs

@@ -11,11 +11,11 @@ namespace ZhonTai.Admin.Core.Db.Transaction;
 public class TransactionAsyncInterceptor : IAsyncInterceptor
 {
     private IUnitOfWork _unitOfWork;
-    private readonly UnitOfWorkManagerCloud _unitOfWorkManager;
+    private readonly UnitOfWorkManagerCloud _unitOfWorkManagerCloud;
 
-    public TransactionAsyncInterceptor(UnitOfWorkManagerCloud unitOfWorkManager)
+    public TransactionAsyncInterceptor(UnitOfWorkManagerCloud unitOfWorkManagerCloud)
     {
-        _unitOfWorkManager = unitOfWorkManager;
+        _unitOfWorkManagerCloud = unitOfWorkManagerCloud;
     }
 
     private bool TryBegin(IInvocation invocation)
@@ -26,7 +26,7 @@ public class TransactionAsyncInterceptor : IAsyncInterceptor
         {
             IsolationLevel? isolationLevel = transaction.IsolationLevel == 0 ? null : transaction.IsolationLevel;
 
-            _unitOfWork = _unitOfWorkManager.Begin(transaction.DbKey, transaction.Propagation, isolationLevel);
+            _unitOfWork = _unitOfWorkManagerCloud.Begin(transaction.DbKey, transaction.Propagation, isolationLevel);
             return true;
         }
 

+ 0 - 5
src/platform/ZhonTai.Admin/Core/Dto/CreateFreeSqlTenantDto.cs

@@ -18,9 +18,4 @@ public class CreateFreeSqlTenantDto
     /// 连接字符串
     /// </summary>
     public string ConnectionString { get; set; }
-
-    /// <summary>
-    /// 空闲时间(分)
-    /// </summary>
-    public int? IdleTime { get; set; }
 }

+ 0 - 1
src/platform/ZhonTai.Admin/Domain/Tenant/TenantEntity.cs

@@ -2,7 +2,6 @@
 using FreeSql;
 using FreeSql.DataAnnotations;
 using System;
-using ZhonTai.Admin.Domain.Role;
 using ZhonTai.Admin.Domain.User;
 
 namespace ZhonTai.Admin.Domain.Tenant;

+ 0 - 1
src/platform/ZhonTai.Admin/Services/Tenant/Dto/TenantListOutput.cs

@@ -1,6 +1,5 @@
 using System;
 using Newtonsoft.Json;
-using ZhonTai.Admin.Core.Entities;
 
 namespace ZhonTai.Admin.Services.Tenant.Dto;
 

+ 2 - 4
src/platform/ZhonTai.Admin/Services/Tenant/TenantService.cs

@@ -20,9 +20,7 @@ using ZhonTai.Admin.Domain.Org;
 using ZhonTai.Admin.Domain.Staff;
 using ZhonTai.Admin.Domain;
 using FreeSql;
-using Microsoft.Extensions.DependencyInjection;
 using ZhonTai.Admin.Core.Db;
-using ZhonTai.Admin.Core.Db.Transaction;
 
 namespace ZhonTai.Admin.Services.Tenant;
 
@@ -117,10 +115,9 @@ public class TenantService : BaseService, ITenantService, IDynamicApi
         TenantEntity tenant = await _tenantRepository.InsertAsync(entity);
         long tenantId = tenant.Id;
 
-        
         var cloud = LazyGetRequiredService<FreeSqlCloud>();
         var tenantDb = cloud.GetTenantDb(ServiceProvider, tenantId);
-
+        
         //添加部门
         var org = new OrgEntity
         {
@@ -130,6 +127,7 @@ public class TenantService : BaseService, ITenantService, IDynamicApi
             ParentId = 0,
             MemberCount = 1
         };
+        
         await tenantDb.GetRepositoryBase<OrgEntity>().InsertAsync(org);
 
         //添加主管理员

+ 0 - 5
src/platform/ZhonTai.Admin/ZhonTai.Admin.xml

@@ -902,11 +902,6 @@
             连接字符串
             </summary>
         </member>
-        <member name="P:ZhonTai.Admin.Core.Dto.CreateFreeSqlTenantDto.IdleTime">
-            <summary>
-            空闲时间(分)
-            </summary>
-        </member>
         <member name="T:ZhonTai.Admin.Core.Dto.IResultOutput">
             <summary>
             结果输出接口