李昊 4 年之前
父節點
當前提交
17fd069c2c

+ 1 - 1
gx_api/GxPress/Repository/GxPress.Repository.Implement/Note/NoteRepository.cs

@@ -739,7 +739,7 @@ namespace GxPress.Repository.Implement.Note
             var query = Q.NewQuery();
             query.Select(nameof(Entity.Note.Note.FolderId));
             query.Where(nameof(Entity.Note.Note.UserId), userId);
-            query.Where(nameof(Entity.Note.Note.IsTop), true);
+            query.Where(nameof(Entity.Note.Note.IsTopic), true);
             query.Where(nameof(Entity.Note.Note.FolderId), ">", 0);
             query.OrderByDesc(nameof(Entity.Note.Note.CreatedDate));
             return await _repository.GetAllAsync<int>(query);

+ 2 - 5
gx_api/GxPress/Repository/GxPress.Repository.Implement/RecordFolder/RecordFolderRepository.cs

@@ -59,11 +59,8 @@ namespace GxPress.Repository.Implement.RecordFolder
             var middle = await _middleRepository.GetAsync(folderId);
             if (middle == null)
                 return true;
-            if (folderType == 21)
-            {
-                if (middle.RoleId == 2)
-                    throw new Common.Exceptions.BusinessException("文件夹私有");
-            }
+            if (middle.RoleId == 2)
+                throw new Common.Exceptions.BusinessException("文件夹私有");
             if (recordFolder == null)
             {
                 //添加

+ 13 - 2
gx_api/GxPress/Service/GxPress.Service.Implement/Middle/MiddleService.cs

@@ -441,7 +441,7 @@ namespace GxPress.Service.Implement.Middle
                     if (request.ParentId > 0 && middle != null)
                     {
                         //获取父级子集集合
-                        var ids = await _middleRepository.GetAllMiddleChildrenByParentIdAsync(request.Ids.ToList(),request.Ids.ToList());
+                        var ids = await _middleRepository.GetAllMiddleChildrenByParentIdAsync(request.Ids.ToList(), request.Ids.ToList());
                         //修改
                         await _middleRepository.UpdateAsync(Q.Set(nameof(Entity.Middle.Middle.ParentId), request.ParentId).Set(nameof(Entity.Middle.Middle.RoleId), middle.RoleId).WhereIn(nameof(Entity.Middle.Middle.Id), request.Ids));
                         //修改共享
@@ -481,7 +481,7 @@ namespace GxPress.Service.Implement.Middle
                         await _middleRepository.UpdateAsync(Q.Set(nameof(Entity.Middle.Middle.ParentId), request.ParentId).WhereIn(nameof(Entity.Middle.Middle.Id), request.Ids));
                         foreach (var item in request.Ids)
                         {
-                            var ids = await _middleRepository.GetAllMiddleChildrenByParentIdAsync(new List<int> { item },new List<int> { });
+                            var ids = await _middleRepository.GetAllMiddleChildrenByParentIdAsync(new List<int> { item }, new List<int> { });
                             await _middleRepository.UpdateAsync(Q.Set(nameof(Entity.Middle.Middle.MiddleSonId), item).WhereIn(nameof(Entity.Middle.Middle.Id), ids));
                         }
                     }
@@ -779,6 +779,17 @@ namespace GxPress.Service.Implement.Middle
             // result.MiddleId = middle == null ? 0 : middle.Id;
             var recordFolder = await recordFolderRepository.GetAsync(folderType, userId);
             var result = new MiddleDefaultResult();
+            //获取笔记默认
+            if (recordFolder.Id == 0 && folderType == 21)
+            {
+                var middle = await _middleRepository.GetMiddleAsync(Q.Where(nameof(Entity.Middle.Middle.FolderType), AllTypeConst.Note.GetHashCode()).Where(nameof(Entity.Middle.Middle.AttributeValue), 2).Where(nameof(Entity.Middle.Middle.IsSystemDefault), true).Where(nameof(Entity.Middle.Middle.UserId), userId));
+                result.IsDefault = middle != null ? middle.IsSystemDefault : false;
+                result.FolderName = middle != null ? middle.FolderName : "";
+                result.FolderType = middle != null ? middle.FolderType : 0;
+                result.MiddleId = middle == null ? middle.Id : 0;
+                return result;
+            }
+            result = new MiddleDefaultResult();
             result.IsDefault = recordFolder != null;
             result.FolderName = recordFolder == null ? "" : recordFolder.FolderName;
             result.FolderType = recordFolder == null ? 0 : recordFolder.FolderType;

+ 2 - 2
gx_api/GxPress/Service/GxPress.Service.Implement/Note/NoteService.cs

@@ -122,7 +122,7 @@ namespace GxPress.Service.Implement.Note
                     {
                         FolderId = request.FolderId,
                         MiddleId = noteId,
-                        FolderType = 4,
+                        FolderType = AllTypeConst.Note.GetHashCode(),
                         UserId = request.UserId,
                         MiddleSonId = 0,
                         AttributeValue = 1,
@@ -132,7 +132,7 @@ namespace GxPress.Service.Implement.Note
                     //修改话题访问量
                     await _visitService.AddVisit(request.UserId, AllTypeConst.Note.GetHashCode(), noteId);
                     //添加默认文件夹
-                    await recordFolderRepository.AddAsync(request.IsTopic ? 21 : 4, request.UserId, request.FolderId);
+                    await recordFolderRepository.AddAsync(request.IsTopic ? 21 : AllTypeConst.Note.GetHashCode(), request.UserId, request.FolderId);
                     transactionScope.Complete();
                 }
             }