xf 2 vuotta sitten
vanhempi
commit
686e358e09
1 muutettua tiedostoa jossa 2 lisäystä ja 1 poistoa
  1. 2 1
      src/Hotline.Api/Controllers/RoleController.cs

+ 2 - 1
src/Hotline.Api/Controllers/RoleController.cs

@@ -6,6 +6,7 @@ using Hotline.Repository.SqlSugar.Extensions;
 using Hotline.Settings;
 using Hotline.Share.Dtos;
 using Hotline.Share.Dtos.Roles;
+using Hotline.Share.Enums.Identity;
 using Hotline.Share.Enums.Settings;
 using MapsterMapper;
 using Microsoft.AspNetCore.Mvc;
@@ -65,7 +66,7 @@ public class RoleController : BaseController
     public async Task<PagedDto<RoleDto>> QueryPaged([FromQuery] QueryRolesPagedDto dto)
     {
         var (total, items) = await _roleRepository.Queryable(includeDeleted: dto.IncludeDeleted)
-            .Includes(d => d.Accounts)
+            .Includes(d => d.Accounts.Where(x => !x.IsDeleted && x.Status == EAccountStatus.Normal).ToList())
             .WhereIF(!string.IsNullOrEmpty(dto.Keyword), d => d.Name.Contains(dto.Keyword!) || d.DisplayName.Contains(dto.Keyword!))
             .OrderByDescending(d => d.CreationTime)
             .ToPagedListAsync(dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);