diff --git a/Src/Dlhis.Basic/Organization/Controllers/DepartmentsController.cs b/Src/Dlhis.Basic/Organization/Controllers/DepartmentsController.cs index f2809833..20a185b2 100644 --- a/Src/Dlhis.Basic/Organization/Controllers/DepartmentsController.cs +++ b/Src/Dlhis.Basic/Organization/Controllers/DepartmentsController.cs @@ -29,4 +29,15 @@ public class DepartmentsController : ControllerBase { return await _departmentService.GetTreeAsync(); } -} + + /// + /// 获取下一级 + /// + /// + /// + [HttpGet("next")] + public async Task> GetNextListAsync(string nextNo) + { + return await _departmentService.GetNextListAsync(nextNo); + } +} \ No newline at end of file diff --git a/Src/Dlhis.Basic/Organization/Request/GainfoOutsourceRequest.cs b/Src/Dlhis.Basic/Organization/Request/GainfoOutsourceRequest.cs index 35d9ef8a..1efc7e7a 100644 --- a/Src/Dlhis.Basic/Organization/Request/GainfoOutsourceRequest.cs +++ b/Src/Dlhis.Basic/Organization/Request/GainfoOutsourceRequest.cs @@ -33,7 +33,7 @@ public class GainfoOutsourceRequest /// /// 生日 /// - public DateTime Birthday { get; set; } + public DateTime? Birthday { get; set; } /// /// 手机号码 diff --git a/Src/Dlhis.Basic/Organization/Services/IDepartmentService.cs b/Src/Dlhis.Basic/Organization/Services/IDepartmentService.cs index 5e3784c1..059f571c 100644 --- a/Src/Dlhis.Basic/Organization/Services/IDepartmentService.cs +++ b/Src/Dlhis.Basic/Organization/Services/IDepartmentService.cs @@ -5,4 +5,6 @@ namespace Dlhis.Basic.Organization.Services; public interface IDepartmentService : IScopeDependency { Task> GetTreeAsync(); -} + + Task> GetNextListAsync(string nextNo); +} \ No newline at end of file diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/DepartmentService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/DepartmentService.cs index 3f796a97..5cd3bfa2 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/DepartmentService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/DepartmentService.cs @@ -1,6 +1,7 @@ using Dlhis.Basic.Organization.Response; using Dlhis.Entity.Basic.Entity; using Kurisu.AspNetCore.DataAccess.SqlSugar.Services; +using Kurisu.AspNetCore.Utils.Extensions; namespace Dlhis.Basic.Organization.Services.Implements; @@ -23,6 +24,16 @@ public class DepartmentService : IDepartmentService return tops; } + + public async Task> GetNextListAsync(string nextNo) + { + return await _dbContext.Queryable() + .WhereIF(nextNo.IsPresent(), x => x.PNo == nextNo) + .WhereIF(nextNo.IsEmpty(), x => x.PNo == "00001000") + .Select() + .ToListAsync(); + } + //***************************************************** help methods **************************************************************** private static void RecursionGetNext(DepartmentTreeResponse current, List data) diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs index 196a521d..bd7f5fc0 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs @@ -70,8 +70,8 @@ public class GainfoService : IGainfoService } var page = await _gainfoStore.Queryable(request.Status) - .WhereIF(request.DepartmentSelections.IsPresent(), where) - .WhereIF(request.DepartmentSelections.IsEmpty(), gainfo => gainfo.Factory == currentTenantId) + .WhereIF(request.DepartmentSelections?.Any() == true, where) + .WhereIF(request.DepartmentSelections?.Any() != true, gainfo => gainfo.Factory == currentTenantId) .WhereIF(request.IsOutsource.HasValue && request.IsOutsource.Value, gainfo => SqlFunc.Subqueryable().Where(x => x.Code == gainfo.Code).Any()) .WhereIF(request.IsOutsource.HasValue && !request.IsOutsource.Value, gainfo => SqlFunc.Subqueryable().Where(x => x.Code == gainfo.Code).NotAny()) .WhereIF(request.Search.IsPresent(), gainfo =>