feat 设备连接注册,sap人事范围,部门
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services;
|
||||
|
||||
public interface IDepartmentService : IScopeDependency
|
||||
{
|
||||
Task<List<DepartmentTreeResponse>> GetTreeAsync();
|
||||
}
|
||||
8
Src/Dlhis.Basic/Organization/Services/IWerkService.cs
Normal file
8
Src/Dlhis.Basic/Organization/Services/IWerkService.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services;
|
||||
|
||||
public interface IWerkService : IScopeDependency
|
||||
{
|
||||
Task<List<WerkResponse>> GetListAsync();
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services.Implements;
|
||||
|
||||
public class DepartmentService : IDepartmentService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
|
||||
public DepartmentService(IDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task<List<DepartmentTreeResponse>> GetTreeAsync()
|
||||
{
|
||||
var departments = await _dbContext.Queryable<DepartmentEntity>().ToListAsync();
|
||||
var tops = departments.Where(x => x.PCode.IsEmpty()).Adapt<List<DepartmentTreeResponse>>();
|
||||
|
||||
tops.ForEach(x =>
|
||||
{
|
||||
RecursionGetNext(x, departments);
|
||||
});
|
||||
|
||||
return tops;
|
||||
}
|
||||
|
||||
|
||||
private void RecursionGetNext(DepartmentTreeResponse current, List<DepartmentEntity> departments)
|
||||
{
|
||||
var next = departments.Where(x => x.PCode == current.Code).ToList();
|
||||
current.Next = next.Adapt<List<DepartmentTreeResponse>>();
|
||||
foreach (var item in next)
|
||||
{
|
||||
RecursionGetNext(item.Adapt<DepartmentTreeResponse>(), departments);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.SqlSugar.Services;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services.Implements;
|
||||
|
||||
public class WerkService : IWerkService
|
||||
{
|
||||
private readonly IDbContext _dbContext;
|
||||
|
||||
public WerkService(IDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task<List<WerkResponse>> GetListAsync()
|
||||
{
|
||||
return await _dbContext.Queryable<WerkEntity>()
|
||||
.Select<WerkResponse>()
|
||||
.ToListAsync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user