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;
}
///
/// 获取租户分页
///
///
///
[HttpGet("page")]
public async Task> GetPageAsync([FromQuery] TenantPageRequest request)
{
return await _tenantService.GetPageAsync(request);
}
///
/// 获取所有租户
///
///
[HttpGet("list")]
public async Task> GetListAsync()
{
return await _tenantService.GetListAsync();
}
///
/// 内部使用接口
///
///
[AllowAnonymous]
[HttpGet("list-internal")]
public async Task> GetListInternalAsync()
{
return await _tenantService.GetListAsync();
}
///
/// 获取租户
///
///
[HttpGet("single")]
public async Task GetTenantByCode(string code)
{
return await _tenantService.GetTenantByCode(code);
}
}