From 38d69c9e6f2742e1d87bef5174d52c45a971e504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com> Date: Thu, 26 Jan 2023 11:25:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=AF=84=E8=AE=BA=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/Yi.Framework.Template/Program.cs | 2 +- .../Dtos/Comment/CommentCreateInputVo.cs | 20 +++++++++++++++ .../Dtos/Comment/CommentGetListInputVo.cs | 18 +++++++++++++ .../Dtos/Comment/CommentGetListOutputDto.cs | 18 +++++++++++++ .../Forum/Dtos/Comment/CommentGetOutputDto.cs | 18 +++++++++++++ .../Dtos/Comment/CommentUpdateInputVo.cs | 17 +++++++++++++ .../Forum/ICommentService.cs | 18 +++++++++++++ .../Forum/CommentService.cs | 17 +++++++++++++ .../Forum/MapperConfig/CommentProfile.cs | 23 +++++++++++++++++ .../Forum/ConstClasses/CommentConst.cs | 16 ++++++++++++ .../Forum/Entities/CommentEntity.cs | 25 +++++++++++++++++++ .../bbs/Yi.BBS.Domain/Forum/ForumManager.cs | 3 ++- 12 files changed, 193 insertions(+), 2 deletions(-) create mode 100644 Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentCreateInputVo.cs create mode 100644 Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentGetListInputVo.cs create mode 100644 Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentGetListOutputDto.cs create mode 100644 Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentGetOutputDto.cs create mode 100644 Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentUpdateInputVo.cs create mode 100644 Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/ICommentService.cs create mode 100644 Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/CommentService.cs create mode 100644 Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/MapperConfig/CommentProfile.cs create mode 100644 Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Forum/ConstClasses/CommentConst.cs create mode 100644 Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/CommentEntity.cs 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 e64d361c..7b660a7e 100644 --- a/Yi.Framework.Net6/src/module/Yi.Framework.Template/Program.cs +++ b/Yi.Framework.Net6/src/module/Yi.Framework.Template/Program.cs @@ -16,7 +16,7 @@ TemplateFactory templateFactory = new(); //List entityNames = new() { "Banner" }; string modelName = "Forum"; string nameSpaces = "Yi.BBS"; -List entityNames = new() { "Plate" }; +List entityNames = new() { "Comment" }; diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentCreateInputVo.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentCreateInputVo.cs new file mode 100644 index 00000000..dbf65e7e --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentCreateInputVo.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos +{ + /// + /// Comment输入创建对象 + /// + public class CommentCreateInputVo + { + public long Id { get; set; } + public DateTime? CreateTime { get; set; } + public string Content { get; set; } + public long DiscussId { get; set; } + public long UserId { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentGetListInputVo.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentGetListInputVo.cs new file mode 100644 index 00000000..59e9a9d5 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentGetListInputVo.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 CommentGetListInputVo : PagedAndSortedResultRequestDto + { + public long Id { get; set; } + public DateTime? CreateTime { get; set; } + public string Content { get; set; } + public long DiscussId { get; set; } + public long UserId { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentGetListOutputDto.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentGetListOutputDto.cs new file mode 100644 index 00000000..d1e59e27 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentGetListOutputDto.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 CommentGetListOutputDto : IEntityDto + { + public long Id { get; set; } + public DateTime? CreateTime { get; set; } + public string Content { get; set; } + public long DiscussId { get; set; } + public long UserId { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentGetOutputDto.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentGetOutputDto.cs new file mode 100644 index 00000000..291c642e --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentGetOutputDto.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 CommentGetOutputDto : IEntityDto + { + public long Id { get; set; } + public DateTime? CreateTime { get; set; } + public string Content { get; set; } + public long DiscussId { get; set; } + public long UserId { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentUpdateInputVo.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentUpdateInputVo.cs new file mode 100644 index 00000000..8c8d993d --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentUpdateInputVo.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos +{ + public class CommentUpdateInputVo + { + public long Id { get; set; } + public DateTime? CreateTime { get; set; } + public string Content { get; set; } + public long DiscussId { get; set; } + public long UserId { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/ICommentService.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/ICommentService.cs new file mode 100644 index 00000000..eccbc829 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/ICommentService.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.BBS.Application.Contracts.Forum.Dtos; +using Yi.Framework.Ddd.Services.Abstract; + +namespace Yi.BBS.Application.Contracts.Forum +{ + /// + /// Comment服务抽象 + /// + public interface ICommentService : ICrudAppService + { + + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/CommentService.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/CommentService.cs new file mode 100644 index 00000000..15600324 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/CommentService.cs @@ -0,0 +1,17 @@ +using Yi.BBS.Application.Contracts.Forum; +using NET.AutoWebApi.Setting; +using Yi.BBS.Application.Contracts.Forum.Dtos; +using Yi.BBS.Domain.Forum.Entities; +using Yi.Framework.Ddd.Services; + +namespace Yi.BBS.Application.Forum +{ + /// + /// Comment服务实现 + /// + [AppService] + public class CommentService : CrudAppService, + ICommentService, IAutoApiService + { + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/MapperConfig/CommentProfile.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/MapperConfig/CommentProfile.cs new file mode 100644 index 00000000..9d581293 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/MapperConfig/CommentProfile.cs @@ -0,0 +1,23 @@ +using AutoMapper; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.BBS.Application.Contracts.Forum.Dtos; +using Yi.BBS.Domain.Forum.Entities; + +namespace Yi.BBS.Application.Forum.MapperConfig +{ + public class CommentProfile: Profile + { + public CommentProfile() + { + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + CreateMap(); + } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Forum/ConstClasses/CommentConst.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Forum/ConstClasses/CommentConst.cs new file mode 100644 index 00000000..c661d369 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Forum/ConstClasses/CommentConst.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.BBS.Domain.Shared.Forum.ConstClasses +{ + /// + /// 常量定义 + /// + + public class CommentConst + { + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/CommentEntity.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/CommentEntity.cs new file mode 100644 index 00000000..0f84f69d --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/CommentEntity.cs @@ -0,0 +1,25 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.Framework.Data.Entities; +using Yi.Framework.Ddd.Entities; + +namespace Yi.BBS.Domain.Forum.Entities +{ + [SugarTable("Comment")] + public class CommentEntity : IEntity, ISoftDelete + { + [SugarColumn(IsPrimaryKey = true)] + public long Id { get; set; } + public bool IsDeleted { get; set; } + + public DateTime? CreateTime { get; set; } + public string Content { get; set; } + + public long DiscussId { get; set; } + public long UserId { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/ForumManager.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/ForumManager.cs index 327b5cb2..6148f6ca 100644 --- a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/ForumManager.cs +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/ForumManager.cs @@ -17,7 +17,8 @@ namespace Yi.BBS.Domain.Forum { private readonly IRepository _discussRepository; private readonly IRepository _plateEntityRepository; - public ForumManager(IRepository discussRepository, IRepository plateEntityRepository) + private readonly IRepository commentRepository; + public ForumManager(IRepository discussRepository, IRepository plateEntityRepository,IRepository commentRepository) { _discussRepository = discussRepository; _plateEntityRepository = plateEntityRepository;