diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoGroupService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoGroupService.cs index ea35ff11..55df243d 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoGroupService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoGroupService.cs @@ -53,7 +53,7 @@ public class GainfoGroupService : IGainfoGroupService { _dbContext.Client.QueryFilter.Restore(); } - + if (!request.Id.HasValue) { @@ -86,6 +86,9 @@ public class GainfoGroupService : IGainfoGroupService public async Task AssignGainfosAsync(GainfoAssignRequest request) { + var existsNextGroup = await _dbContext.Queryable().Where(x => x.PCode == request.GroupCode).AnyAsync(); + existsNextGroup.ThrowIfTrue("存在下级分组,无法分配人员"); + var relations = await _dbContext.Queryable().Where(x => x.GroupCode == request.GroupCode).ToListAsync(); await _dbContext.DeleteReallyAsync(relations);