feat 设备连接注册,sap人事范围,部门

This commit is contained in:
2023-12-28 16:04:00 +08:00
parent 25f7b3270c
commit d7cf07d940
48 changed files with 633 additions and 65 deletions

View File

@@ -0,0 +1,8 @@
using Dlhis.Basic.Organization.Response;
namespace Dlhis.Basic.Organization.Services;
public interface IDepartmentService : IScopeDependency
{
Task<List<DepartmentTreeResponse>> GetTreeAsync();
}

View File

@@ -0,0 +1,8 @@
using Dlhis.Basic.Organization.Response;
namespace Dlhis.Basic.Organization.Services;
public interface IWerkService : IScopeDependency
{
Task<List<WerkResponse>> GetListAsync();
}

View File

@@ -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);
}
}
}

View File

@@ -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();
}
}