65 lines
1.6 KiB
C#
65 lines
1.6 KiB
C#
using Dlhis.Sys.Identity.Request;
|
|
using Dlhis.Sys.Identity.Response;
|
|
using Dlhis.Sys.Identity.Services;
|
|
using Kurisu.Core.DataAccess.Dto;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace Dlhis.Sys.Identity.Controllers;
|
|
|
|
[Authorize]
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class TenantsController : ControllerBase
|
|
{
|
|
private readonly ITenantService _tenantService;
|
|
|
|
public TenantsController(ITenantService tenantService)
|
|
{
|
|
_tenantService = tenantService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取租户分页
|
|
/// </summary>
|
|
/// <param name="request"></param>
|
|
/// <returns></returns>
|
|
[HttpGet("page")]
|
|
public async Task<Pagination<TenantResponse>> GetPageAsync([FromQuery] TenantPageRequest request)
|
|
{
|
|
return await _tenantService.GetPageAsync(request);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取所有租户
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("list")]
|
|
public async Task<List<TenantResponse>> GetListAsync()
|
|
{
|
|
return await _tenantService.GetListAsync();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 内部使用接口
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[AllowAnonymous]
|
|
[HttpGet("list-internal")]
|
|
public async Task<List<TenantResponse>> GetListInternalAsync()
|
|
{
|
|
return await _tenantService.GetListAsync();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取租户
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet("single")]
|
|
public async Task<TenantResponse> GetTenantByCode(string code)
|
|
{
|
|
return await _tenantService.GetTenantByCode(code);
|
|
}
|
|
|
|
}
|