李昊 4 years ago
parent
commit
6d3fba7b26

+ 4 - 3
gx_api/GxPress/Api/GxPress.Api/AppControllers/UserController.cs

@@ -211,7 +211,7 @@ namespace GxPress.Api.AppControllers
         public async Task<bool> Update([FromBody] UserInfoRequest request)
         {
             var id = _loginContext.AccountId;
-            var result = await _userRepository.UpdateAsync(id, request);
+            var result = await _userService.UpdateAsync(id, request);
             if (result == false)
                 throw new BusinessException("更新失败");
             return true;
@@ -398,8 +398,9 @@ namespace GxPress.Api.AppControllers
         /// 获取用户的通讯录
         /// </summary>
         /// <returns></returns>
-         [HttpGet("user-link")]
-        public async Task<UserLinkResult> GetUserLinkResultAsync(){
+        [HttpGet("user-link")]
+        public async Task<UserLinkResult> GetUserLinkResultAsync()
+        {
             return await _userService.GetUserLinkResultAsync(_loginContext.AccountId);
         }
     }

+ 1 - 1
gx_api/GxPress/Api/GxPress.Api/WebControllers/UserController.cs

@@ -226,7 +226,7 @@ namespace GxPress.Api.WebControllers
         public async Task<bool> Update([FromBody] UserInfoRequest request)
         {
             var id = _loginContext.AccountId;
-            var result = await _userRepository.UpdateAsync(id, request);
+            var result = await _userService.UpdateAsync(id, request);
             if (result == false)
                 throw new BusinessException("更新失败");
             return true;

+ 6 - 0
gx_api/GxPress/Model/GxPress.Entity/User.cs

@@ -63,6 +63,12 @@ namespace GxPress.Entity
         public int DepartmentId { get; set; }
 
         /// <summary>
+        /// 部门名称
+        /// </summary>
+        [DataColumn]
+        public string DepartmentName { get; set; }
+
+        /// <summary>
         /// 职位
         /// </summary>
         [DataColumn]

+ 6 - 0
gx_api/GxPress/Model/GxPress.Request/User/UserRequest.cs

@@ -54,6 +54,12 @@ namespace GxPress.Request.User
 
         public IEnumerable<int> DepartmentId { get; set; }
 
+         /// <summary>
+        /// 部门id
+        /// </summary>
+
+        public string DepartmentName { get; set; }
+
         /// <summary>
         /// 职位
         /// </summary>

+ 1 - 1
gx_api/GxPress/Repository/GxPress.Repository.Implement/NoticeRepository.cs

@@ -537,7 +537,7 @@ namespace GxPress.Repository.Implement
                                     WHERE a.IsRecall=0 and 
                                         a.UserId = {request.UserId} and a.FolderType={noticeTypeValue}
                                             {sb}
-                                    ORDER BY a.IsTop desc,a.LastModifiedDate desc,a.AttributeValue desc
+                                    ORDER BY a.AttributeValue,a.IsTop desc,a.LastModifiedDate desc desc
                                     LIMIT {(request.Page - 1) * request.PerPage},{request.PerPage}";
             var countSql = string.Format(@"SELECT 
                                        count(1)

+ 3 - 0
gx_api/GxPress/Repository/GxPress.Repository.Implement/UserRepository.cs

@@ -406,6 +406,9 @@ namespace GxPress.Repository.Implement
                 user.RoleId = request.RoleId;
             if (!string.IsNullOrEmpty(request.Signature))
                 user.Signature = request.Signature;
+            //修改部门
+            if (!string.IsNullOrEmpty(request.DepartmentName))
+                user.DepartmentName = request.DepartmentName;
             //用户头像
             if (!string.IsNullOrEmpty(request.AvatarUrl))
             {

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

@@ -205,11 +205,11 @@ namespace GxPress.Service.Implement
             var items = list.Select(user => _mapper.Map<UserResult>(user)).ToList();
             foreach (var item in items)
             {
-                var departmentName = string.Empty;
-                //获取部门
-                departmentName =
-                    await _departmentRepository.GetDepartmentFullPathAsync(item.DepartmentId, departmentName);
-                item.DepartmentName = departmentName;
+                // var departmentName = string.Empty;
+                // //获取部门
+                // departmentName =
+                //     await _departmentRepository.GetDepartmentFullPathAsync(item.DepartmentId, departmentName);
+                // item.DepartmentName = departmentName;
                 var role = await _roleRepository.GetAsync(item.RoleId);
                 if (role != null)
                     item.RoleName = role.Name;