feat: 搭建多租户框架
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using Volo.Abp.DependencyInjection;
|
||||
using Yi.Framework.SqlSugarCore.Abstractions;
|
||||
using Yi.Framework.SqlSugarCore.Repositories;
|
||||
using Yi.Framework.TenantManagement.Domain;
|
||||
|
||||
namespace Yi.Framework.TenantManagement.SqlSugarCore
|
||||
{
|
||||
public class SqlSugarTenantRepository : SqlSugarRepository<TenantAggregateRoot, Guid>, ISqlSugarTenantRepository,ITransientDependency
|
||||
{
|
||||
public SqlSugarTenantRepository(ISugarDbContextProvider<ISqlSugarDbContext> sugarDbContextProvider) : base(sugarDbContextProvider)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<TenantAggregateRoot> FindByNameAsync(string name, bool includeDetails = true)
|
||||
{
|
||||
return await _DbQueryable.FirstAsync(x => x.Name == name);
|
||||
}
|
||||
|
||||
public async Task<long> GetCountAsync(string filter = null)
|
||||
{
|
||||
return await _DbQueryable.WhereIF(!string.IsNullOrEmpty(filter),x=>x.Name.Contains(filter)) .CountAsync();
|
||||
}
|
||||
|
||||
public async Task<List<TenantAggregateRoot>> GetListAsync(string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, string filter = null, bool includeDetails = false)
|
||||
{
|
||||
|
||||
|
||||
return await _DbQueryable.WhereIF(!string.IsNullOrEmpty(filter), x => x.Name.Contains(filter))
|
||||
.OrderByIF(!string.IsNullOrEmpty(sorting), sorting)
|
||||
.ToPageListAsync(skipCount, maxResultCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\framework\Yi.Framework.SqlSugarCore\Yi.Framework.SqlSugarCore.csproj" />
|
||||
<ProjectReference Include="..\Yi.Framework.TenantManagement.Domain\Yi.Framework.TenantManagement.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,10 @@
|
||||
using Volo.Abp.Modularity;
|
||||
using Yi.Framework.TenantManagement.Domain;
|
||||
|
||||
namespace Yi.Framework.TenantManagement.SqlSugarCore
|
||||
{
|
||||
[DependsOn(typeof(YiFrameworkTenantManagementDomainModule))]
|
||||
public class YiFrameworkTenantManagementSqlSugarCoreModule : AbpModule
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user