李昊 %!s(int64=4) %!d(string=hai) anos
pai
achega
5895f2ebe0

+ 5 - 1
gx_api/GxPress/Model/GxPress.Request/Department/DepartmentUserRequest.cs

@@ -10,7 +10,11 @@ namespace GxPress.Request.Department
 
         public bool IsShow { get; set; }
 
-        public IEnumerable<int> UserIds { get; set; }
+        public List<int> UserIds { get; set; }
+        public DepartmentUserRequest(){
+            UserIds=new List<int>();
+        }
+
     }
     /// <summary>
     /// 添加部门用户

+ 9 - 1
gx_api/GxPress/Model/GxPress.Result/App/Note/NoteResult.cs

@@ -200,6 +200,14 @@ namespace GxPress.Result.App.Note
         /// 阅读数量
         /// </summary>
         /// <value></value>
-        public int ReadCount{get;set;}
+        public int ReadCount { get; set; }
+        /// <summary>
+        /// 文件夹名称
+        /// </summary>
+        public string FolderName { get; set; }
+        /// <summary>
+        /// 文件夹Id
+        /// </summary>
+        public int FolderId { get; set; }
     }
 }

+ 6 - 2
gx_api/GxPress/Repository/GxPress.Repository.Implement/DepartmentRepository.cs

@@ -20,6 +20,7 @@ namespace GxPress.Repository.Implement
         private readonly IMapper _mapper;
         private readonly Repository<Department> _repository;
         private readonly Repository<User> _userRepository;
+        private readonly Repository<Entity.DepartmentUser> departmentUserRepository;
 
         public DepartmentRepository(IOptionsMonitor<DatabaseOptions> dbOptionsAccessor, IMapper mapper)
         {
@@ -27,6 +28,7 @@ namespace GxPress.Repository.Implement
             var database = new Database(databaseType, dbOptionsAccessor.CurrentValue.ConnectionString);
             _repository = new Repository<Department>(database);
             _userRepository = new Repository<User>(database);
+            departmentUserRepository = new Repository<Entity.DepartmentUser>(database);
             _mapper = mapper;
         }
 
@@ -217,7 +219,9 @@ namespace GxPress.Repository.Implement
             var result = new DepartmentUserResult();
             var departments = await GetListAsync(request);
             result.Departments = departments;
-            var users = await _userRepository.GetAllAsync(Q.Where(nameof(User.DepartmentId), request.DepartmentId));
+            //获取用户ID
+            var departmentUsers = await departmentUserRepository.GetAllAsync<int>(Q.WhereIn(nameof(Entity.DepartmentUser.DepartmentId), departments.Select(n => n.Id)).Select(nameof(Entity.DepartmentUser.UserId)));
+            var users = await _userRepository.GetAllAsync(Q.WhereIn(nameof(User.Id), departmentUsers));
             result.Users = users.ToList();
             for (int i = 0; i < result.Users.Count(); i++)
             {
@@ -284,7 +288,7 @@ namespace GxPress.Repository.Implement
                 foreach (var item in list)
                 {
                     // result.Add(item);
-                   await GetDepartmentById(item.Id, departments);
+                    await GetDepartmentById(item.Id, departments);
                 }
 
             }