李昊 hace 4 años
padre
commit
790a9f102d

+ 1 - 5
gx_api/GxPress/Service/GxPress.Service.Implement/UserService.cs

@@ -493,14 +493,10 @@ namespace GxPress.Service.Implement
         {
             var user = await _userRepository.GetAsync(id);
             if (user == null) throw new BusinessException("该用户不存在");
-            if (request.DepartmentId.Count() > 0)
-            {
+            if (request.DepartmentId != null && request.DepartmentId.Count() > 0)
                 await departmentUserRepository.AddDepartmentUserAsync(request.DepartmentId, id);
-            }
             if (!string.IsNullOrEmpty(request.DepartmentName))
-            {
                 user.DepartmentName = request.DepartmentName;
-            }
             if (!string.IsNullOrEmpty(request.Nick))
                 user.Nick = request.Nick;
             if (!string.IsNullOrEmpty(request.Description))