diff --git a/Yi.Framework.Net6/src/module/Yi.Framework.Template/Program.cs b/Yi.Framework.Net6/src/module/Yi.Framework.Template/Program.cs
index 61c1ac70..b5c98a2e 100644
--- a/Yi.Framework.Net6/src/module/Yi.Framework.Template/Program.cs
+++ b/Yi.Framework.Net6/src/module/Yi.Framework.Template/Program.cs
@@ -47,5 +47,5 @@ Console.WriteLine("Yi.Framework.Template:模板全部生成完成!");
Console.ReadKey();
//根据模板文件生成项目文件
-//var template = "D:\\C#\\Yi\\Yi.Framework.Net6\\src\\project\\BBS";
-//FileHelper.AllInfoReplace(template, "Template", "BBS");
\ No newline at end of file
+//var template = "D:\\C#\\Yi\\Yi.Framework.Net6\\src\\project\\template";
+//FileHelper.AllInfoReplace(template, "Template", "RBAC");
\ No newline at end of file
diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application/ApplicationSwaggerDoc.xml b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application/ApplicationSwaggerDoc.xml
index a6680e5e..9dc71566 100644
--- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application/ApplicationSwaggerDoc.xml
+++ b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application/ApplicationSwaggerDoc.xml
@@ -14,6 +14,14 @@
Article服务实现
+
+
+ 获取文章全部平铺信息
+
+
+
+
+
查询文章
diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain/DomainSwaggerDoc.xml b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain/DomainSwaggerDoc.xml
index df627c2b..91f7886c 100644
--- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain/DomainSwaggerDoc.xml
+++ b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain/DomainSwaggerDoc.xml
@@ -4,6 +4,13 @@
Yi.BBS.Domain
+
+
+ 平铺自己
+
+
+
+
论坛模块的领域服务
diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/yi-sqlsugar-dev.db b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/yi-sqlsugar-dev.db
index acbfad10..cdfebb08 100644
Binary files a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/yi-sqlsugar-dev.db and b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/yi-sqlsugar-dev.db differ
diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleAllOutputDto.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleAllOutputDto.cs
new file mode 100644
index 00000000..e800be39
--- /dev/null
+++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleAllOutputDto.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Yi.Framework.Ddd.Dtos;
+
+namespace Yi.BBS.Application.Contracts.Forum.Dtos
+{
+ public class ArticleAllOutputDto : IEntityDto
+ {
+ public long Id { get; set; }
+ public string Content { get; set; }
+ public string Name { get; set; }
+ public long DiscussId { get; set; }
+ public long ParentId { get; set; }
+ }
+}
diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleGetListOutputDto.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleGetListOutputDto.cs
index 8ba00442..466433fd 100644
--- a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleGetListOutputDto.cs
+++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleGetListOutputDto.cs
@@ -13,7 +13,6 @@ namespace Yi.BBS.Application.Contracts.Forum.Dtos
public string Content { get; set; }
public string Name { get; set; }
public long DiscussId { get; set; }
- public long ParentId { get; set; }
public List Children { get; set; }
}
diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/ArticleService.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/ArticleService.cs
index fc2c31c0..200ef445 100644
--- a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/ArticleService.cs
+++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/ArticleService.cs
@@ -15,15 +15,37 @@ namespace Yi.BBS.Application.Forum
/// Article服务实现
///
[AppService]
+
public class ArticleService : CrudAppService,
IArticleService, IAutoApiService
{
[Autowired]
private IArticleRepository _articleRepository { get; set; }
+
[Autowired]
private IRepository _discussRepository { get; set; }
+ ///
+ /// 获取文章全部平铺信息
+ ///
+ ///
+ ///
+ ///
+ [Route("/api/article/all/discuss-id/{discussId}")]
+ public async Task> GetAllAsync([FromRoute] long discussId)
+ {
+ if (!await _discussRepository.IsAnyAsync(x => x.Id == discussId))
+ {
+ throw new UserFriendlyException(DiscussConst.主题不存在);
+ }
+
+ var entities = await _articleRepository.GetTreeAsync(x => x.DiscussId == discussId);
+ var result = entities.Tile();
+ var items = _mapper.Map>(result);
+ return items;
+ }
+
///
/// 查询文章
///
@@ -37,7 +59,7 @@ namespace Yi.BBS.Application.Forum
throw new UserFriendlyException(DiscussConst.主题不存在);
}
- var entities = await _articleRepository.GetTreeAsync(x=>x.DiscussId==discussId);
+ var entities = await _articleRepository.GetTreeAsync(x => x.DiscussId == discussId);
var items = await MapToGetListOutputDtosAsync(entities);
return items;
}
diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/MapperConfig/ArticleProfile.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/MapperConfig/ArticleProfile.cs
index f827724c..2bde67b2 100644
--- a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/MapperConfig/ArticleProfile.cs
+++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/MapperConfig/ArticleProfile.cs
@@ -16,6 +16,7 @@ namespace Yi.BBS.Application.Forum.MapperConfig
CreateMap();
CreateMap();
CreateMap();
+ CreateMap();
CreateMap();
CreateMap();
}
diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/ArticleEntity.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/ArticleEntity.cs
index 70d5b188..2b3e8473 100644
--- a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/ArticleEntity.cs
+++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/ArticleEntity.cs
@@ -1,7 +1,9 @@
-using SqlSugar;
+using Microsoft.AspNetCore.Http;
+using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Data.Entities;
@@ -26,4 +28,32 @@ namespace Yi.BBS.Domain.Forum.Entities
public List Children { get; set; }
}
+
+ public static class ArticleEntityExtensions
+ {
+ ///
+ /// 平铺自己
+ ///
+ ///
+ ///
+ public static List Tile(this List entities)
+ {
+ var result = new List();
+ return StartRecursion(entities, result);
+ }
+
+ private static List StartRecursion(List entities, List result)
+ {
+ foreach (var entity in entities)
+ {
+ result.Add(entity);
+ if (entity.Children is not null && entity.Children.Where(x => x.IsDeleted == false).Count() > 0)
+ {
+ StartRecursion(entity.Children, result);
+ }
+ }
+ return result;
+ }
+
+ }
}
diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/TestAutofac.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/TestAutofac.cs
deleted file mode 100644
index aa35c91b..00000000
--- a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/TestAutofac.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace Yi.BBS.Web
-{
- public class TestAutofac
- {
- [Autowired]
- public TestAutofac2 _testAutofac2 { get; set; }
- }
-}
diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/TestAutofac2.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/TestAutofac2.cs
deleted file mode 100644
index 3f431298..00000000
--- a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/TestAutofac2.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace Yi.BBS.Web
-{
- public class TestAutofac2
- {
- }
-}