李昊 4 年之前
父节点
当前提交
52f46dd4d4

+ 6 - 1
gx_api/GxPress/Model/GxPress.Request/App/Middle/MiddleMoveRequest.cs

@@ -12,11 +12,16 @@ namespace GxPress.Request.App.Middle
         /// <summary>
         /// 移动ID
         /// </summary>
-        public List<int> Ids { get; set; }
+        public IEnumerable<int> Ids { get; set; }
         /// <summary>
         /// 父级ID
         /// 父级ID
         /// </summary>
         public int ParentId { get; set; }
+        /// <summary>
+        ///  
+        /// </summary>
+        /// <value></value>
+        public int TypeId { get; set; }
     }
 }

+ 13 - 0
gx_api/GxPress/Repository/GxPress.Repository.Implement/MiddleRepository.cs

@@ -283,5 +283,18 @@ namespace GxPress.Repository.Implement
             query.Where(nameof(Middle.UserId), request.UserId);
             return await _repository.GetAllAsync(query.Select("Id", "Guid", "CreatedDate", "LastModifiedDate", "FolderName", "FolderType", "IsTop", "RoleId", "Sort", "MiddleId", "ParentId", "UserId", "MiddleSonId", "IsRead", "NoticeAddresseeType", "IsAdmin", "IsDelete", "AttributeValue", "IsDefault", "IsUpload", "Title", "AddressUser", "CcUser"));
         }
+        /// <summary>
+        /// 排除不是文件夹的ID
+        /// </summary>
+        /// <param name="ids"></param>
+        /// <returns></returns>
+        public async Task<IEnumerable<int>> GetMiddleIsFolderAsync(IEnumerable<int> ids)
+        {
+            var query = Q.NewQuery();
+            query.Select(nameof(Entity.Middle.Middle.Id));
+            query.WhereIn(nameof(Entity.Middle.Middle.Id), ids);
+            query.Where(nameof(Entity.Middle.Middle.AttributeValue), 2);
+            return await _repository.GetAllAsync<int>(query);
+        }
     }
 }

+ 6 - 0
gx_api/GxPress/Repository/GxPress.Repository.Interface/IMiddleRepository.cs

@@ -85,5 +85,11 @@ namespace GxPress.Repository.Interface
         Task<IEnumerable<Middle>> FindAsync(InboxSearchRequest request);
          Task<bool> ExistsAsync(SqlKata.Query query);
          Task<int> GetSytemFolderAsync(int userId);
+          /// <summary>
+        /// 排除不是文件夹的ID
+        /// </summary>
+        /// <param name="ids"></param>
+        /// <returns></returns>
+        Task<IEnumerable<int>> GetMiddleIsFolderAsync(IEnumerable<int> ids);
     }
 }

+ 3 - 1
gx_api/GxPress/Service/GxPress.Service.Implement/Middle/MiddleService.cs

@@ -422,9 +422,11 @@ namespace GxPress.Service.Implement.Middle
         {
             return await _middleRepository.RecoverDeleteAsync(request);
         }
-
+          
         public async Task<bool> SetMove(MiddleMoveRequest request)
         {
+            if (request.ParentId == 0 && request.TypeId == -AllTypeConst.Note.GetHashCode())
+                request.Ids = await _middleRepository.GetMiddleIsFolderAsync(request.Ids);
             return await _middleRepository.UpdateAsync(Q.Set(nameof(Entity.Middle.Middle.ParentId), request.ParentId).WhereIn(nameof(Entity.Middle.Middle.Id), request.Ids));
         }
         /// <summary>