feat;添加评论

This commit is contained in:
陈淳
2023-03-22 19:49:20 +08:00
parent 4b856c4905
commit 30329ea4db
8 changed files with 141 additions and 27 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SqlSugar;
namespace Yi.BBS.Application.Contracts.Forum.Dtos
{
@@ -11,7 +12,19 @@ namespace Yi.BBS.Application.Contracts.Forum.Dtos
/// </summary>
public class CommentCreateInputVo
{
public string Content { get; set; }
public long DiscussId { get; set; }
/// <summary>
/// 根节点的评论id这里也可根据树形查询获取到根节点但是不够优雅前端是二维数组选择前端传值即可,如果是根传0如果不是
/// </summary>
public long RootId { get; set; }
/// <summary>
/// 被回复的CommentId
/// </summary>
public long ParentId { get; set; }
}
}

View File

@@ -3,11 +3,17 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SqlSugar;
using Yi.Framework.Ddd.Dtos;
namespace Yi.BBS.Application.Contracts.Forum.Dtos
{
public class CommentGetListInputVo : PagedAndSortedResultRequestDto
public class CommentGetListInputVo
{
public DateTime? CreateTime { get; set; }
public string? Content { get; set; }
//应该选择具体莫个主题查询
public long? DiscussId { get; set; }
}
}

View File

@@ -3,16 +3,45 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SqlSugar;
using Yi.Framework.Ddd.Dtos;
using Yi.RBAC.Application.Contracts.Identity.Dtos;
namespace Yi.BBS.Application.Contracts.Forum.Dtos
{
/// <summary>
/// 评论多反
/// </summary>
public class CommentGetListOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public DateTime? CreateTime { get; set; }
public string Content { get; set; }
/// <summary>
/// 根节点的评论id
/// </summary>
public long RootId { get; set; }
/// <summary>
/// 主题id
/// </summary>
public long DiscussId { get; set; }
public long UserId { get; set; }
public long ParentId { get; set; }
/// <summary>
/// 用户,评论人用户信息,被评论的用户信息,是他的上一个节点评论
/// </summary>
public UserGetOutputDto User { get; set; }
/// <summary>
/// 这个不是一个树形而是存在一个二维数组该Children只有一层
/// </summary>
public List<CommentGetListOutputDto> Children { get; set; } = new List<CommentGetListOutputDto>();
}
}

View File

@@ -3,16 +3,39 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SqlSugar;
using Yi.Framework.Ddd.Dtos;
using Yi.RBAC.Application.Contracts.Identity.Dtos;
namespace Yi.BBS.Application.Contracts.Forum.Dtos
{
/// <summary>
/// 单返回,返回单条评论即可
/// </summary>
public class CommentGetOutputDto : IEntityDto<long>
{
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; }
/// <summary>
/// 用户id联表为用户对象
/// </summary>
public UserGetOutputDto User { get; set; }
/// <summary>
/// 根节点的评论id
/// </summary>
public long RootId { get; set; }
/// <summary>
/// 被回复的CommentId
/// </summary>
public long ParentId { get; set; }
}
}

View File

@@ -3,15 +3,15 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SqlSugar;
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; }
//更新不能将评论转移
}
}