Files
jinko.yikatong/Src/Dlhis.User/Identity/Controllers/TenantsController.cs

55 lines
1.3 KiB
C#

using Dlhis.User.Identity.Request;
using Dlhis.User.Identity.Response;
using Dlhis.User.Identity.Services;
using Kurisu.Core.DataAccess.Dto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Dlhis.User.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("single")]
public async Task<TenantResponse> GetTenantByCode(string code)
{
return await _tenantService.GetTenantByCode(code);
}
}