feat 组织架构
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using Dlhis.External.OpenApi.Response;
|
||||
using Dlhis.External.OpenApi.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Dlhis.External.OpenApi.Controllers;
|
||||
|
||||
[Authorize]
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class DepartmentsController : ControllerBase
|
||||
{
|
||||
private readonly IGainfoService _gainfoService;
|
||||
|
||||
public DepartmentsController(IGainfoService gainfoService)
|
||||
{
|
||||
_gainfoService = gainfoService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有部门信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("all")]
|
||||
public async Task<List<DepartmentOpenResponse>> GetDepartmentsAsync()
|
||||
{
|
||||
return await _gainfoService.GetDepartmentsAsync();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using SqlSugar;
|
||||
|
||||
namespace Dlhis.External.OpenApi.Response;
|
||||
|
||||
public class DepartmentOpenResponse
|
||||
{
|
||||
public string No { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 上级部门号
|
||||
/// </summary>
|
||||
public string PNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
}
|
||||
@@ -5,4 +5,6 @@ namespace Dlhis.External.OpenApi.Services;
|
||||
public interface IGainfoService : IScopeDependency
|
||||
{
|
||||
Task<List<GainfoOpenResponse>> GetAllGainfosAsync();
|
||||
|
||||
Task<List<DepartmentOpenResponse>> GetDepartmentsAsync();
|
||||
}
|
||||
|
||||
@@ -18,4 +18,11 @@ public class GainfoService : IGainfoService
|
||||
var data = await _redisCache.ListRangeAsync("gainfo:shanxi");
|
||||
return data.Select(x => x.ToString().ToObject<GainfoOpenResponse>()).ToList();
|
||||
}
|
||||
|
||||
public async Task<List<DepartmentOpenResponse>> GetDepartmentsAsync()
|
||||
{
|
||||
var departmentKey = "department:all";
|
||||
var data = await _redisCache.ListRangeAsync(departmentKey);
|
||||
return data.Select(x => x.ToString().ToObject<DepartmentOpenResponse>()).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user