Files
jinko.yikatong/Src/Dlhis.Basic/Organization/Controllers/DepartmentsController.cs
2024-02-20 11:07:04 +08:00

47 lines
1.3 KiB
C#

using Dlhis.Basic.Organization.Request;
using Dlhis.Basic.Organization.Response;
using Dlhis.Basic.Organization.Services;
using Kurisu.AspNetCore.MVC;
using Kurisu.Core.DataAccess.Dto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Dlhis.Basic.Organization.Controllers;
/// <summary>
/// sap部门
/// </summary>
[Authorize]
[ApiDefinition("SAP", Description = "晶科sap组织架构信息")]
[Route("api/[controller]")]
[ApiController]
public class DepartmentsController : ControllerBase
{
private readonly IDepartmentService _departmentService;
public DepartmentsController(IDepartmentService departmentService)
{
_departmentService = departmentService;
}
/// <summary>
/// 获取部门树
/// </summary>
/// <returns></returns>
[HttpGet("tree")]
public async Task<List<DepartmentTreeResponse>> GetTreeAsync()
{
return await _departmentService.GetTreeAsync();
}
/// <summary>
/// 获取部门树分页
/// </summary>
/// <returns></returns>
[HttpGet("treepage")]
public async Task<Pagination<DepartmentTreeResponse>> GetTreePageAsync([FromQuery]DepartmentPageRequest request)
{
return await _departmentService.GetTreePageAsync(request);
}
}