feat: 完成租户前端对接

This commit is contained in:
橙子
2024-02-08 19:48:35 +08:00
parent 39d472bdc8
commit 36f72c857d
12 changed files with 92 additions and 15 deletions

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.TenantManagement.Application.Contracts.Dtos
{
public class TenantSelectOutputDto : EntityDto<Guid>
{
public string Name { get; set; }
}
}

View File

@@ -1,19 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Reflection;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using SqlSugar;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Data;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Modularity;
using Volo.Abp.Uow;
using Yi.Framework.Ddd.Application;
using Yi.Framework.SqlSugarCore.Abstractions;
using Yi.Framework.TenantManagement.Application.Contracts;
@@ -60,6 +52,17 @@ namespace Yi.Framework.TenantManagement.Application
return new PagedResultDto<TenantGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
}
/// <summary>
/// 租户选项
/// </summary>
/// <returns></returns>
public async Task<List<TenantSelectOutputDto>> GetSelectAsync()
{
var entites = await _repository._DbQueryable.ToListAsync();
return entites.Select(x => new TenantSelectOutputDto { Id = x.Id, Name = x.Name }).ToList();
}
/// <summary>
/// 创建租户
/// </summary>
@@ -108,11 +111,11 @@ namespace Yi.Framework.TenantManagement.Application
/// <param name="id"></param>
/// <returns></returns>
[HttpPut("tenant/init/{id}")]
public async Task InitAsync([FromRoute]Guid id)
public async Task InitAsync([FromRoute] Guid id)
{
using (CurrentTenant.Change(id))
{
await CodeFirst(this.LazyServiceProvider);
await CodeFirst(this.LazyServiceProvider);
await _dataSeeder.SeedAsync(id);
}