李昊 vor 4 Jahren
Ursprung
Commit
b2f1d981cb

+ 1 - 1
gx_api/GxPress/Repository/GxPress.Repository.Implement/ArticleGroupRepository.cs

@@ -81,7 +81,7 @@ namespace GxPress.Repository.Implement
         }
         public async Task<IEnumerable<ArticleGroup>> GetListAsync(int userId)
         {
-            string sql = $@"select * from tede_article_group where Id not  in(SELECT ArticleGroupId FROM tede_article_group_user where UserId={userId}) or IsSystemDefault=1";
+            string sql = $@"select * from tede_article_group where Id not  in(SELECT ArticleGroupId FROM tede_article_group_user where UserId={userId}) or IsSystemDefault=0";
             var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
             var database = new Database(databaseType, _connectionString);
             var connection = database.GetConnection();

+ 5 - 1
gx_api/GxPress/Repository/GxPress.Repository.Implement/ArticleGroupUserRepository.cs

@@ -82,13 +82,17 @@ namespace GxPress.Repository.Implement
         {
             var list = await _repository.GetAllAsync(Q.Where(nameof(ArticleGroupUser.UserId), request.UserId));
             var listArray = list.Select(n => _mapper.Map<ArticleGroupUserListResult>(n)).ToList();
+            var articleGroups = await _articleGroupRepository.GetAllAsync(Q.Where(nameof(ArticleGroup.IsSystemDefault), true));
+            foreach (var item in articleGroups)
+            {
+                listArray.Add(new ArticleGroupUserListResult() { Id = 0, UserId = request.UserId, ArticleGroupId = item.Id, ArticleGroupName = item.Name, StyleCss = item.StyleCss });
+            }
             foreach (var item in listArray)
             {
                 var articleGroup = await _articleGroupRepository.GetAsync(item.ArticleGroupId);
                 item.ArticleGroupName = articleGroup.Name;
                 item.StyleCss = articleGroup.StyleCss;
             }
-
             return listArray;
         }
     }