From 5141ce601c6e1a0826567a522ab1a8b0da293cc0 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Tue, 11 Jun 2024 16:46:26 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E8=8E=B7=E5=8F=96=E9=83=A8=E9=97=A8?= =?UTF-8?q?=E4=B8=8B=E4=B8=80=E7=BA=A7,=E6=89=A9=E5=B1=95=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/DepartmentsController.cs | 13 ++++++++++++- .../Organization/Request/GainfoOutsourceRequest.cs | 2 +- .../Organization/Services/IDepartmentService.cs | 4 +++- .../Services/Implements/DepartmentService.cs | 11 +++++++++++ .../Services/Implements/GainfoService.cs | 4 ++-- 5 files changed, 29 insertions(+), 5 deletions(-) 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 =>