李昊 4 年之前
父節點
當前提交
7b6a732493

+ 5 - 0
GxPress/Model/GxPress.Result/ArticleGroupUser/ArticleGroupUserListResult.cs

@@ -26,5 +26,10 @@ namespace GxPress.Result.ArticleGroupUser
         /// 频道名称
         /// </summary>
         public string ArticleGroupName { get; set; }
+        /// <summary>
+        /// 是否系统默认
+        /// </summary>
+        /// <value></value>
+        public bool IsSystemDefault { get; set; }
     }
 }

+ 13 - 2
GxPress/Repository/GxPress.Repository.Implement/ArticleGroupUserRepository.cs

@@ -114,6 +114,17 @@ namespace GxPress.Repository.Implement
         /// <returns></returns>
         public async Task<IEnumerable<ArticleGroupUserListResult>> GetListAsync(ArticleGroupUserSearchRequest request)
         {
+            var result = new List<ArticleGroupUserListResult>();
+            var articleGroups = await _articleGroupRepository.GetAllAsync(Q.Where(nameof(Entity.ArticleGroup.IsSystemDefault), true));
+            foreach (var item in articleGroups)
+                result.Add(new ArticleGroupUserListResult
+                {
+                    Id = 0,
+                    ArticleGroupId = item.Id,
+                    ArticleGroupName = item.Name,
+                    IsSystemDefault = item.IsSystemDefault,
+                    UserId = request.UserId
+                });
             var list = await _repository.GetAllAsync(Q.Where(nameof(ArticleGroupUser.UserId), request.UserId));
             var listArray = list.Select(n => _mapper.Map<ArticleGroupUserListResult>(n)).ToList();
             foreach (var item in listArray)
@@ -121,8 +132,8 @@ namespace GxPress.Repository.Implement
                 var articleGroup = await _articleGroupRepository.GetAsync(item.ArticleGroupId);
                 item.ArticleGroupName = articleGroup.Name;
             }
-
-            return listArray;
+            result.AddRange(listArray);
+            return result;
         }
     }
 }