李昊 4 years ago
parent
commit
3a8461a24c

+ 2 - 2
gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminSystemLabelController.cs

@@ -62,9 +62,9 @@ namespace GxPress.Api.AdminControllers
         /// </summary>
         /// <returns></returns>
         [HttpPost("list-page")]
-        public async Task<PagedList<SystemLabelResult>> GetAllPageAsync(Common.Page.PageParameter pageParameter)
+        public async Task<PagedList<SystemLabelResult>> GetAllPageAsync(SystemLabelRequest request)
         {
-            return await systemLabelService.GetAllPageAsync(pageParameter);
+            return await systemLabelService.GetAllPageAsync(request);
         }
         /// <summary>
         /// 删除

+ 7 - 2
gx_api/GxPress/Model/GxPress.Request/Media/MediaRequest.cs

@@ -314,10 +314,15 @@ namespace GxPress.Request.Media
     public class MediaStarLableRequest : Common.Page.PageParameter
     {
         /// <summary>
-        /// 明栏ID
+        /// 
         /// </summary>
         /// <value></value>
-        public int AttachId { get; set; }
+        public int Id { get; set; }
+        /// <summary>
+        /// 媒体ID
+        /// </summary>
+        /// <value></value>
+        public List<int> MediaIds { get; set; }
         /// <summary>
         /// 关键字
         /// </summary>

+ 9 - 2
gx_api/GxPress/Model/GxPress.Request/SystemLabel/SystemLabelRequest.cs

@@ -1,8 +1,15 @@
 namespace GxPress.Request.SystemLabel
 {
-    public class SystemLabelRequest
+    /// <summary>
+    /// 
+    /// </summary>
+    public class SystemLabelRequest:Common.Page.PageParameter
     {
-
+        /// <summary>
+        /// 0 标签 1 明栏
+        /// </summary>
+        /// <value></value>
+       public int TypeValue{get;set;}
     }
     /// <summary>
     /// 修改系统标签

+ 3 - 3
gx_api/GxPress/Repository/GxPress.Repository.Implement/Media/MediaRepository.cs

@@ -816,7 +816,7 @@ namespace GxPress.Repository.Implement.Media
             query.Select(nameof(Entity.tede2.Media.Media.CreatedDate));
             if (!string.IsNullOrEmpty(request.KeyWord))
                 query.WhereLike(nameof(Entity.tede2.Media.Media.Title), $"%{request.KeyWord}%");
-            query.Where(nameof(Entity.tede2.Media.Media.AttachId), request.AttachId);
+            query.Where(nameof(Entity.tede2.Media.Media.AttachId), request.MediaIds);
             resut.Total = await _repository.CountAsync(query);
             if (!string.IsNullOrEmpty(request.Sort))
             {
@@ -830,7 +830,7 @@ namespace GxPress.Repository.Implement.Media
             return resut;
         }
         /// <summary>
-        /// 明栏分页
+        /// 明栏
         /// </summary>
         /// <returns></returns>
         public async Task<IEnumerable<MediaCathedraResult>> GetStarLablesAsync(MediaStarLableRequest request)
@@ -845,7 +845,7 @@ namespace GxPress.Repository.Implement.Media
             query.Select(nameof(Entity.tede2.Media.Media.CreatedDate));
             if (!string.IsNullOrEmpty(request.KeyWord))
                 query.WhereLike(nameof(Entity.tede2.Media.Media.Title), $"%{request.KeyWord}%");
-            query.Where(nameof(Entity.tede2.Media.Media.AttachId), request.AttachId);
+            query.WhereIn(nameof(Entity.tede2.Media.Media.Id), request.MediaIds);
             if (!string.IsNullOrEmpty(request.Sort))
             {
                 query.OrderByDesc(nameof(Entity.tede2.Media.Media.IsTop));

+ 2 - 1
gx_api/GxPress/Repository/GxPress.Repository.Implement/SystemLabel/SystemLabelRepository.cs

@@ -96,12 +96,13 @@ namespace GxPress.Repository.Implement.SystemLabel
         /// </summary>
         /// <param name="request"></param>
         /// <returns></returns>
-        public async Task<PagedList<SystemLabelResult>> GetAllPageAsync(Common.Page.PageParameter request)
+        public async Task<PagedList<SystemLabelResult>> GetAllPageAsync(SystemLabelRequest request)
         {
             var result = new PagedList<SystemLabelResult>();
             var query = Q.NewQuery();
             query.Where(nameof(Entity.SystemLabel.SystemLabel.IsDisable), false);
             query.Where(nameof(Entity.SystemLabel.SystemLabel.IsStarLable), false);
+            query.Where(nameof(Entity.SystemLabel.SystemLabel.IsStarLable),request.TypeValue);
             result.Total = await _repository.CountAsync(query);
             query.OrderByDesc(nameof(Entity.Navigations.Navigation.Sort));
             query.ForPage(request.Page, request.PerPage);

+ 1 - 1
gx_api/GxPress/Repository/GxPress.Repository.Interface/SystemLabel/ISystemLabelRepository.cs

@@ -16,7 +16,7 @@ namespace GxPress.Repository.Interface.SystemLabel
         Task<int> InsertAsync(Entity.SystemLabel.SystemLabel note);
 
         Task<bool> UpdateAsync(SystemLabelUpRequest note);
-        Task<PagedList<SystemLabelResult>> GetAllPageAsync(Common.Page.PageParameter request);
+        Task<PagedList<SystemLabelResult>> GetAllPageAsync(SystemLabelRequest request);
         Task<IEnumerable<Entity.SystemLabel.SystemLabel>> GetAllAsync(List<int> ids);
         Task<Entity.SystemLabel.SystemLabel> GetByNameAsync(string name);
         Task<IEnumerable<SystemLabelResult>> GetAllAsync();

+ 8 - 4
gx_api/GxPress/Service/GxPress.Service.Implement/Media/MediaService.StarLable.cs

@@ -1,4 +1,5 @@
 using System.Collections.Generic;
+using System.Linq;
 using System.Threading.Tasks;
 using GxPress.Common.Page;
 using GxPress.Request.Media;
@@ -19,17 +20,18 @@ namespace GxPress.Service.Implement.Media
         {
             var result = new List<MediaStarLableResult>();
             //获取明栏
-            var starLable = await attachRepository.GetStarLablesAsync();
+            var starLable = await systemLabelRepository.GetStarLableAllAsync();
             foreach (var item in starLable)
             {
+                var meidas = await systemLableMediaRepository.GetMediaIdsAsync(item.Id, 0);
                 var request = new MediaStarLableRequest()
                 {
-                    AttachId = item.Item1
+                    MediaIds = meidas.ToList()
                 };
                 var mediaStarLableResult = new MediaStarLableResult()
                 {
-                    Id = item.Item1,
-                    Name = item.Item2,
+                    Id = item.Id,
+                    Name = item.LabelName,
                     Item = await mediaRepository.GetStarLablesAsync(request)
                 };
                 result.Add(mediaStarLableResult);
@@ -42,6 +44,8 @@ namespace GxPress.Service.Implement.Media
         /// <returns></returns>
         public async Task<PagedList<MediaCathedraResult>> GetStarLablePageAsync(MediaStarLableRequest request)
         {
+            var meidas = await systemLableMediaRepository.GetMediaIdsAsync(request.Id, 0);
+            request.MediaIds = meidas.ToList();
             return await mediaRepository.GetStarLablePageAsync(request);
         }
     }

+ 7 - 3
gx_api/GxPress/Service/GxPress.Service.Implement/Media/MediaService.cs

@@ -12,7 +12,7 @@ using System;
 using GxPress.Repository.Interface;
 using GxPress.Repository.Interface.Order;
 using GxPress.Repository.Interface.Attach;
-
+using GxPress.Repository.Interface.SystemLabel;
 namespace GxPress.Service.Implement.Media
 {
     public partial class MediaService : IMediaService
@@ -25,7 +25,9 @@ namespace GxPress.Service.Implement.Media
         private readonly IUserRepository userRepository;
         private readonly IOrderRepository orderRepository;
         private readonly IAttachRepository attachRepository;
-        public MediaService(ICategoryRepository categoryRepository, IMediaRepository mediaRepository, IMapper _mapper, IEpubService epubService, IMediaLibraryRepository mediaLibraryRepository, IUserRepository userRepository, IOrderRepository orderRepository,IAttachRepository attachRepository)
+        private readonly ISystemLabelRepository systemLabelRepository;
+        private readonly ISystemLableMediaRepository systemLableMediaRepository;
+        public MediaService(ICategoryRepository categoryRepository, IMediaRepository mediaRepository, IMapper _mapper, IEpubService epubService, IMediaLibraryRepository mediaLibraryRepository, IUserRepository userRepository, IOrderRepository orderRepository, IAttachRepository attachRepository, ISystemLabelRepository systemLabelRepository, ISystemLableMediaRepository systemLableMediaRepository)
         {
             this.categoryRepository = categoryRepository;
             this.mediaRepository = mediaRepository;
@@ -34,7 +36,9 @@ namespace GxPress.Service.Implement.Media
             this.mediaLibraryRepository = mediaLibraryRepository;
             this.userRepository = userRepository;
             this.orderRepository = orderRepository;
-            this.attachRepository=attachRepository;
+            this.attachRepository = attachRepository;
+            this.systemLabelRepository = systemLabelRepository;
+            this.systemLableMediaRepository = systemLableMediaRepository;
         }
         public async Task<bool> InsertAsync(MediaResult result)
         {

+ 2 - 1
gx_api/GxPress/Service/GxPress.Service.Implement/SystemLabel/SystemLabelService.cs

@@ -4,6 +4,7 @@ using System.Threading.Tasks;
 using GxPress.Common.Page;
 using GxPress.Result.SystemLabel;
 using System.Collections.Generic;
+using GxPress.Request.SystemLabel;
 
 namespace GxPress.Service.Implement.SystemLabel
 {
@@ -17,7 +18,7 @@ namespace GxPress.Service.Implement.SystemLabel
             this.systemLableMediaRepository = systemLableMediaRepository;
         }
 
-        public async Task<PagedList<SystemLabelResult>> GetAllPageAsync(Common.Page.PageParameter request)
+        public async Task<PagedList<SystemLabelResult>> GetAllPageAsync(SystemLabelRequest request)
         {
             var result = await systemLabelRepository.GetAllPageAsync(request);
             foreach (var item in result.Items)

+ 2 - 1
gx_api/GxPress/Service/GxPress.Service.Interface/SystemLabel/ISystemLabelService.cs

@@ -1,13 +1,14 @@
 using System.Collections.Generic;
 using System.Threading.Tasks;
 using GxPress.Common.Page;
+using GxPress.Request.SystemLabel;
 using GxPress.Result.SystemLabel;
 
 namespace GxPress.Service.Interface.SystemLabel
 {
     public interface ISystemLabelService : IService
     {
-        Task<PagedList<SystemLabelResult>> GetAllPageAsync(Common.Page.PageParameter request);
+        Task<PagedList<SystemLabelResult>> GetAllPageAsync(SystemLabelRequest request);
         Task<IEnumerable<SystemLabelResult>> GetAllAsync();
         /// <summary>
         /// 获取明栏分页