李昊 4 years ago
parent
commit
d1fd5db4cd

+ 2 - 1
gx_api/GxPress/Service/GxPress.Service.Implement/Department/DepartmentService.cs

@@ -8,6 +8,7 @@ using GxPress.Service.Interface;
 using GxPress.Service.Interface.Department;
 using GxPress.Repository.Interface.DepartmentUser;
 using System.Linq;
+using Datory;
 
 namespace GxPress.Service.Implement.Department
 {
@@ -48,7 +49,7 @@ namespace GxPress.Service.Implement.Department
                     var departments = new List<Entity.Department>();
                     await _departmentRepository.GetDepartmentById(item.Id, departments);
                     var userIds = await departmentUserRepository.GetUserIdsByDepartmentIdsAsync(departments.Select(n => n.Id));
-                    item.UserCount = userIds.Distinct().Count();
+                    item.UserCount =await _userRepository.CountAsync(Q.WhereIn(nameof(Entity.User.Id),userIds));
                 }
 
             }