李昊 4 년 전
부모
커밋
7a67c8b62a

+ 11 - 0
gx_api/GxPress/Api/GxPress.Api/AppControllers/CollectionController.cs

@@ -63,5 +63,16 @@ namespace GxPress.Api.AppControllers
         {
             return await _collectionService.GetCollectionDetailAsync(id);
         }
+        /// <summary>
+        /// 收藏无文件夹分页列表
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("list")]
+        public async Task<PagedList<CollectionListPageResult>> GetCollectionNoFolderPageListAsync(CollectionPageSearchRequest request)
+        {
+            request.UserId=_loginContext.AccountId;
+            return await _collectionService.GetCollectionNoFolderPageListAsync(request);
+        }
     }
 }

+ 11 - 0
gx_api/GxPress/Api/GxPress.Api/WebControllers/WebCollectionController.cs

@@ -62,5 +62,16 @@ namespace GxPress.Api.WebControllers
         {
             return await _collectionService.GetCollectionDetailAsync(id);
         }
+        /// <summary>
+        /// 收藏无文件夹分页列表
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("list")]
+        public async Task<PagedList<CollectionListPageResult>> GetCollectionNoFolderPageListAsync(CollectionPageSearchRequest request)
+        {
+              request.UserId=_loginContext.AccountId;
+            return await _collectionService.GetCollectionNoFolderPageListAsync(request);
+        }
     }
 }

+ 18 - 0
gx_api/GxPress/Repository/GxPress.Repository.Implement/Collection/CollectionRepository.cs

@@ -262,5 +262,23 @@ namespace GxPress.Repository.Implement.Collection
         {
             return await _repository.GetAllAsync(query);
         }
+
+        /// <summary>
+        /// 收藏无文件夹分页列表
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        public async Task<PagedList<CollectionListPageResult>> GetCollectionNoFolderPageListAsync(CollectionPageSearchRequest request)
+        {
+            var result = new PagedList<CollectionListPageResult>();
+            var query = Q.NewQuery();
+            query.Where(nameof(Entity.Collection.UserId), request.UserId);
+            if (!string.IsNullOrEmpty(request.SearchKey))
+                query.WhereLike(nameof(Entity.Collection.Title), $"%{request.SearchKey}%");
+            result.Total = await _repository.CountAsync(query);
+            query.ForPage(request.Page, request.PerPage);
+            result.Items = await _repository.GetAllAsync<CollectionListPageResult>(query);
+            return result;
+        }
     }
 }

+ 7 - 0
gx_api/GxPress/Repository/GxPress.Repository.Interface/Collection/ICollectionRepository.cs

@@ -45,6 +45,13 @@ namespace GxPress.Repository.Interface.Collection
         /// <param name="middleIds"></param>
         /// <returns></returns>
          Task<bool> RecursionDeleteAsync(List<int> middleIds);
+
+           /// <summary>
+        /// 收藏无文件夹分页列表
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+      Task<PagedList<CollectionListPageResult>> GetCollectionNoFolderPageListAsync(CollectionPageSearchRequest request);
     }
 
 }

+ 37 - 1
gx_api/GxPress/Service/GxPress.Service.Implement/Collection/CollectionService.cs

@@ -49,7 +49,7 @@ namespace GxPress.Service.Implement.Collection
         public CollectionService(ICollectionRepository collectionRepository, IMiddleService middleService,
             IArticleRepository articleRepository, ITopicRepository topicRepository, IMiddleRepository middleRepository,
             INoteRepository noteRepository, IUserRepository userRepository, IArticleService articleService, INoticeRepository noticeRepository,
-            IMissiveRepository missiveRepository,  IMapper mapper,
+            IMissiveRepository missiveRepository, IMapper mapper,
             IGroupRepository groupRepository, IMeetingSummaryRepository meetingSummaryRepository, IFolderUserRepository folderUserRepository, IAnalyzeService analyzeService, IFileLibraryRepository fileLibraryRepository, IUserMiddleService userMiddleService)
         {
             _collectionRepository = collectionRepository;
@@ -239,6 +239,42 @@ namespace GxPress.Service.Implement.Collection
             return await _middleService.AddOrUpdateAsync(middleInsertTypeRequest);
         }
         /// <summary>
+        /// 收藏无文件夹分页列表
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        public async Task<PagedList<CollectionListPageResult>> GetCollectionNoFolderPageListAsync(CollectionPageSearchRequest request)
+        {
+            var result = await _collectionRepository.GetCollectionNoFolderPageListAsync(request);
+            foreach (var item in result.Items)
+            {
+                item.Data = await StructCollectionData(item.CollectionDataId, item.CollectionType, item.SourceUserId);
+                if (string.IsNullOrWhiteSpace(item.Title))
+                {
+                    item.Title = "";
+                    if (item.Data.Type == 1)
+                        item.Title = item.Data.Title;
+                    else if (item.Data.Type == 400)
+                        item.Title = item.Data.Title;
+                    else
+                    {
+                        if (item.Data.Data != null)
+                        {
+                            if (item.Data.Type == 1)
+                                item.Title = item.Data.Text;
+                            else if (item.Data.Data.Type == 1)
+                                item.Title = item.Data.Data.Text;
+                            else if (item.Data.Data.Type == 2)
+                                item.Title = "[图片]";
+                            else
+                                item.Title = "[附件]";
+                        }
+                    }
+                }
+            }
+            return result;
+        }
+        /// <summary>
         /// 查询结果
         /// </summary>
         /// <param name="request"></param>

+ 6 - 0
gx_api/GxPress/Service/GxPress.Service.Interface/Collection/ICollectionService.cs

@@ -17,5 +17,11 @@ namespace GxPress.Service.Interface.Collection
         /// <param name="id"></param>
         /// <returns></returns>
         Task<CollectionResult> GetCollectionDetailAsync(int id);
+          /// <summary>
+        /// 收藏无文件夹分页列表
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        Task<PagedList<CollectionListPageResult>> GetCollectionNoFolderPageListAsync(CollectionPageSearchRequest request);
     }
 }