李昊 4 years ago
parent
commit
166cfdb466

BIN
gx_api/GxPress/.DS_Store


+ 6 - 1
gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminSystemLabelController.cs

@@ -2,6 +2,7 @@ using System.Collections.Generic;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using GxPress.Repository.Interface.SystemLabel;
 using GxPress.Repository.Interface.SystemLabel;
 using GxPress.Request.SystemLabel;
 using GxPress.Request.SystemLabel;
+using GxPress.Result.SystemLabel;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.Mvc;
 
 
@@ -41,8 +42,12 @@ namespace GxPress.Api.AdminControllers
         {
         {
             return await _repository.UpdateAsync(request);
             return await _repository.UpdateAsync(request);
         }
         }
+        /// <summary>
+        /// 获取标签列表
+        /// </summary>
+        /// <returns></returns>
         [HttpGet]
         [HttpGet]
-        public async Task<IEnumerable<Entity.SystemLabel.SystemLabel>> GetAllAsync()
+        public async Task<IEnumerable<SystemLabelResult>> GetAllAsync()
         {
         {
             return await _repository.GetAllAsync();
             return await _repository.GetAllAsync();
         }
         }

+ 1 - 3
gx_api/GxPress/Api/GxPress.Api/WebControllers/WebGroupController.cs

@@ -36,7 +36,7 @@ namespace GxPress.Api.WebControllers
         private readonly ITopicRepository _topicRepository;
         private readonly ITopicRepository _topicRepository;
         private readonly ITopicService _topicService;
         private readonly ITopicService _topicService;
         private readonly IGroupCategroyRepository groupCategroyRepository;
         private readonly IGroupCategroyRepository groupCategroyRepository;
-       
+
         public WebGroupController(IGroupRepository groupRepository,
         public WebGroupController(IGroupRepository groupRepository,
             IGroupFolderRepository groupFolderRepository, IGroupUserRepository groupUserRepository,
             IGroupFolderRepository groupFolderRepository, IGroupUserRepository groupUserRepository,
             ILoginContext loginContext, IGroupService groupService, ITopicRepository topicRepository, ITopicService topicService, IGroupCategroyRepository groupCategroyRepository)
             ILoginContext loginContext, IGroupService groupService, ITopicRepository topicRepository, ITopicService topicService, IGroupCategroyRepository groupCategroyRepository)
@@ -219,7 +219,6 @@ namespace GxPress.Api.WebControllers
             var userId = _loginContext.AccountId;
             var userId = _loginContext.AccountId;
             return await _groupUserRepository.SetIsUDisturbAsync(groupId, userId);
             return await _groupUserRepository.SetIsUDisturbAsync(groupId, userId);
         }
         }
-
         /// <summary>
         /// <summary>
         /// 搜索小组成员
         /// 搜索小组成员
         /// </summary>
         /// </summary>
@@ -231,6 +230,5 @@ namespace GxPress.Api.WebControllers
             return await _groupRepository.SearchGroupUserAsync(request);
             return await _groupRepository.SearchGroupUserAsync(request);
         }
         }
 
 
-      
     }
     }
 }
 }

+ 0 - 1
gx_api/GxPress/Model/GxPress.Entity/Department.cs

@@ -25,7 +25,6 @@ namespace GxPress.Entity
         /// </summary>
         /// </summary>
         [DataColumn] 
         [DataColumn] 
         public int LeaderId { get; set; }
         public int LeaderId { get; set; }
-
         /// <summary>
         /// <summary>
         /// 排序
         /// 排序
         /// </summary>
         /// </summary>

+ 97 - 0
gx_api/GxPress/Model/GxPress.Result/SystemLabel/SystemLabelResult.cs

@@ -0,0 +1,97 @@
+namespace GxPress.Result.SystemLabel
+{
+    /// <summary>
+    /// 标签
+    /// </summary>
+    public class SystemLabelResult
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <value></value>
+        public int Id { get; set; }
+        /// <summary>
+        /// 标签名称
+        /// </summary>
+        /// <value></value>
+
+        public string LabelName { get; set; }
+
+        /// <summary>
+        /// 标签名称描述
+        /// </summary>
+        /// <value></value>
+
+        public string LabelNameDescribe { get; set; }
+        /// <summary>
+        /// 备注
+        /// </summary>
+        /// <value></value>
+
+        public string Remark { get; set; }
+
+        /// <summary>
+        /// 是否禁用
+        /// </summary>
+        /// <value></value>
+
+        public bool IsDisable { get; set; }
+
+        /// <summary>
+        /// 排序
+        /// </summary>
+        /// <value></value>
+
+        public int Sort { get; set; }
+
+        /// <summary>
+        /// 是否跳转
+        /// </summary>
+        /// <value></value>
+
+        public bool IsSkip { get; set; }
+
+        /// <summary>
+        /// 是否分页
+        /// </summary>
+        /// <value></value>
+
+        public bool IsPage { get; set; }
+        /// <summary>
+        /// 路径
+        /// </summary>
+        /// <value></value>
+
+        public string ControllerUrl { get; set; }
+        /// <summary>
+        /// 路径
+        /// </summary>
+        /// <value></value>
+
+        public string ActionUrl { get; set; }
+        /// <summary>
+        /// 资源类型 文章100书籍20,课程30,音频40,期刊50,视频60,名栏90,公众号110,刊期120,榜单130,示范课堂140,品牌专区1(150),品牌专区2(160)
+        /// </summary>
+        /// <value></value>
+
+        public int ResourceType { get; set; }
+
+        /// <summary>
+        /// 样式类型
+        /// </summary>
+        /// <value></value>
+
+        public string StyleType { get; set; }
+        /// <summary>
+        /// 是否显示标签名称
+        /// </summary>
+        /// <value></value>
+
+        public bool IsShowLabelName { get; set; }
+        /// <summary>
+        ///资源数量
+        /// </summary>
+        /// <value></value>
+        public int ResourceCount { get; set; }
+    }
+}

+ 14 - 3
gx_api/GxPress/Repository/GxPress.Repository.Implement/SystemLabel/SystemLabelRepository.cs

@@ -6,6 +6,7 @@ using GxPress.Common.AppOptions;
 using GxPress.Common.Tools;
 using GxPress.Common.Tools;
 using GxPress.Repository.Interface.SystemLabel;
 using GxPress.Repository.Interface.SystemLabel;
 using GxPress.Request.SystemLabel;
 using GxPress.Request.SystemLabel;
+using GxPress.Result.SystemLabel;
 using Microsoft.Extensions.Options;
 using Microsoft.Extensions.Options;
 
 
 namespace GxPress.Repository.Implement.SystemLabel
 namespace GxPress.Repository.Implement.SystemLabel
@@ -16,6 +17,7 @@ namespace GxPress.Repository.Implement.SystemLabel
         private readonly IMapper _mapper;
         private readonly IMapper _mapper;
         private readonly string _connectionString;
         private readonly string _connectionString;
         private readonly string _databaseTypestr;
         private readonly string _databaseTypestr;
+        private readonly Repository<Entity.tede2.Media.MediaLable> mediaLableRepository;
         public SystemLabelRepository(IOptionsMonitor<DatabaseOptions> dbOptionsAccessor, IMapper mapper)
         public SystemLabelRepository(IOptionsMonitor<DatabaseOptions> dbOptionsAccessor, IMapper mapper)
         {
         {
             _databaseTypestr = dbOptionsAccessor.CurrentValue.DatabaseType;
             _databaseTypestr = dbOptionsAccessor.CurrentValue.DatabaseType;
@@ -25,6 +27,7 @@ namespace GxPress.Repository.Implement.SystemLabel
             var database = new Database(databaseType, dbOptionsAccessor.CurrentValue.ConnectionString);
             var database = new Database(databaseType, dbOptionsAccessor.CurrentValue.ConnectionString);
             _repository = new Repository<Entity.SystemLabel.SystemLabel>(database);
             _repository = new Repository<Entity.SystemLabel.SystemLabel>(database);
             _mapper = mapper;
             _mapper = mapper;
+            mediaLableRepository = new Repository<Entity.tede2.Media.MediaLable>(database);
         }
         }
 
 
         public IDatabase Database => _repository.Database;
         public IDatabase Database => _repository.Database;
@@ -82,15 +85,23 @@ namespace GxPress.Repository.Implement.SystemLabel
             return await _repository.UpdateAsync(query) > 0;
             return await _repository.UpdateAsync(query) > 0;
         }
         }
 
 
-        public async Task<IEnumerable<Entity.SystemLabel.SystemLabel>> GetAllAsync()
+        public async Task<IEnumerable<SystemLabelResult>> GetAllAsync()
         {
         {
-            return await _repository.GetAllAsync(Q.Where(nameof(Entity.SystemLabel.SystemLabel.IsDisable), false).OrderByDesc(nameof(Entity.Navigations.Navigation.Sort)));
+            var result = await _repository.GetAllAsync<SystemLabelResult>(Q.Where(nameof(Entity.SystemLabel.SystemLabel.IsDisable), false).OrderByDesc(nameof(Entity.Navigations.Navigation.Sort)));
+            foreach (var item in result)
+            {
+                var query = Q.NewQuery();
+                query.Where(nameof(Entity.tede2.Media.MediaLable.LableId), item.Id);
+                //获取资源数量
+                item.ResourceCount = await mediaLableRepository.CountAsync(query);
+            }
+            return result;
         }
         }
         public async Task<IEnumerable<Entity.SystemLabel.SystemLabel>> GetAllAsync(List<int> ids)
         public async Task<IEnumerable<Entity.SystemLabel.SystemLabel>> GetAllAsync(List<int> ids)
         {
         {
             return await _repository.GetAllAsync(Q.WhereIn(nameof(Entity.SystemLabel.SystemLabel.Id), ids));
             return await _repository.GetAllAsync(Q.WhereIn(nameof(Entity.SystemLabel.SystemLabel.Id), ids));
         }
         }
-        
+
 
 
     }
     }
 }
 }

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

@@ -2,6 +2,7 @@ using System.Collections.Generic;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
 using Datory;
 using Datory;
 using GxPress.Request.SystemLabel;
 using GxPress.Request.SystemLabel;
+using GxPress.Result.SystemLabel;
 
 
 namespace GxPress.Repository.Interface.SystemLabel
 namespace GxPress.Repository.Interface.SystemLabel
 {
 {
@@ -14,7 +15,7 @@ namespace GxPress.Repository.Interface.SystemLabel
         Task<int> InsertAsync(Entity.SystemLabel.SystemLabel note);
         Task<int> InsertAsync(Entity.SystemLabel.SystemLabel note);
 
 
         Task<bool> UpdateAsync(SystemLabelUpRequest note);
         Task<bool> UpdateAsync(SystemLabelUpRequest note);
-        Task<IEnumerable<Entity.SystemLabel.SystemLabel>> GetAllAsync();
+        Task<IEnumerable<SystemLabelResult>> GetAllAsync();
         Task<IEnumerable<Entity.SystemLabel.SystemLabel>> GetAllAsync(List<int> ids);
         Task<IEnumerable<Entity.SystemLabel.SystemLabel>> GetAllAsync(List<int> ids);
 
 
     }
     }