From be90d98ee1a1b52d3ec15fadc0629b1d1ca54749 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Thu, 4 Jun 2026 15:18:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B2=A1=E6=9C=89gainfo=E4=B9=9F?= =?UTF-8?q?=E5=B1=9E=E4=BA=8E=E5=B7=AE=E5=BC=82=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Organization/Controllers/GainfoGroupsController.cs | 4 ++-- .../Organization/Services/IGainfoGroupService.cs | 2 +- .../Services/Implements/GainfoGroupService.cs | 4 ++-- .../Services/Implements/GainfoUpdateService.cs | 8 ++++++++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Src/Dlhis.Basic/Organization/Controllers/GainfoGroupsController.cs b/Src/Dlhis.Basic/Organization/Controllers/GainfoGroupsController.cs index 2e3f849f..22c82c70 100644 --- a/Src/Dlhis.Basic/Organization/Controllers/GainfoGroupsController.cs +++ b/Src/Dlhis.Basic/Organization/Controllers/GainfoGroupsController.cs @@ -30,9 +30,9 @@ public class GainfoGroupsController : ControllerBase [HttpGet("tree")] [IgnoreTenant] [DataPermission] - public async Task> GetTreeAsync() + public async Task> GetTreeAsync(string search) { - return await _gainfoGroupService.GetTreeAsync(); + return await _gainfoGroupService.GetTreeAsync(search); } /// diff --git a/Src/Dlhis.Basic/Organization/Services/IGainfoGroupService.cs b/Src/Dlhis.Basic/Organization/Services/IGainfoGroupService.cs index 37f49505..3a7b565e 100644 --- a/Src/Dlhis.Basic/Organization/Services/IGainfoGroupService.cs +++ b/Src/Dlhis.Basic/Organization/Services/IGainfoGroupService.cs @@ -6,7 +6,7 @@ namespace Dlhis.Basic.Organization.Services; public interface IGainfoGroupService : IScopeDependency { - Task> GetTreeAsync(); + Task> GetTreeAsync(string search); Task SaveAsync(GainfoGroupSaveRequest request); diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoGroupService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoGroupService.cs index 1a27914f..8ed29730 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoGroupService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoGroupService.cs @@ -34,7 +34,7 @@ public class GainfoGroupService : IGainfoGroupService _devicePermissionAnalyzeService = devicePermissionAnalyzeService; } - public async Task> GetTreeAsync() + public async Task> GetTreeAsync(string search) { var gainfoGroups = await _dbContext.Queryable() .Select() @@ -129,7 +129,7 @@ public class GainfoGroupService : IGainfoGroupService .Any()) .Select(x => x.No) .ToListAsync(); - + presentUserNos.AddRange(businessUserNos); } finally diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs index 0a0a75d1..2dfeec1c 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs @@ -475,9 +475,17 @@ public class GainfoUpdateService : IGainfoUpdateService .GroupBy(x => x.ZWORKCODE) .ToDictionary(x => x.Key, x => x.First()); + var existingCodes = await _dbContext.Queryable().Where(x => workCodes.Contains(x.Code)).Select(x => x.Code).ToListAsync(); + var modifiedPersons = new List(); foreach (var person in sapList) { + if (!existingCodes.Contains(person.ZWORKCODE)) + { + modifiedPersons.Add(person); + continue; + } + if (string.IsNullOrWhiteSpace(person.ZWORKCODE)) { modifiedPersons.Add(person);