feat:搭建积分领域
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using SqlSugar;
|
||||
using Volo.Abp.Auditing;
|
||||
using Volo.Abp.Domain.Entities;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain.Entities.Forum
|
||||
{
|
||||
[SugarTable("Agree")]
|
||||
public class AgreeEntity : Entity<Guid>, ICreationAuditedObject
|
||||
{
|
||||
public AgreeEntity()
|
||||
{
|
||||
}
|
||||
|
||||
public AgreeEntity(Guid discussId)
|
||||
{
|
||||
DiscussId = discussId;
|
||||
}
|
||||
|
||||
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
|
||||
public override Guid Id { get; protected set; }
|
||||
public DateTime CreationTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主题id
|
||||
/// </summary>
|
||||
public Guid DiscussId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建者
|
||||
/// </summary>
|
||||
public Guid? CreatorId { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
using SqlSugar;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.Auditing;
|
||||
using Volo.Abp.Domain.Entities;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain.Entities.Forum
|
||||
{
|
||||
[SugarTable("Article")]
|
||||
public class ArticleEntity : Entity<Guid>, ISoftDelete, IAuditedObject
|
||||
{
|
||||
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
|
||||
public override Guid Id { get; protected set; }
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString)]
|
||||
public string Content { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
|
||||
public Guid DiscussId { get; set; }
|
||||
|
||||
public Guid ParentId { get; set; }
|
||||
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
|
||||
public List<ArticleEntity>? Children { get; set; }
|
||||
|
||||
|
||||
public DateTime CreationTime { get; set; }
|
||||
|
||||
public Guid? CreatorId { get; set; }
|
||||
|
||||
public Guid? LastModifierId { get; set; }
|
||||
|
||||
public DateTime? LastModificationTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int OrderNum { get; set; } = 0;
|
||||
}
|
||||
|
||||
public static class ArticleEntityExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 平铺自己
|
||||
/// </summary>
|
||||
/// <param name="entities"></param>
|
||||
/// <returns></returns>
|
||||
public static List<ArticleEntity> Tile(this List<ArticleEntity> entities)
|
||||
{
|
||||
if (entities is null) return new List<ArticleEntity>();
|
||||
var result = new List<ArticleEntity>();
|
||||
return StartRecursion(entities, result);
|
||||
}
|
||||
|
||||
private static List<ArticleEntity> StartRecursion(List<ArticleEntity> entities, List<ArticleEntity> 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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using SqlSugar;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.Auditing;
|
||||
using Volo.Abp.Domain.Entities;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain.Entities.Forum
|
||||
{
|
||||
[SugarTable("Banner")]
|
||||
public class BannerEntity : Entity<Guid>, ISoftDelete, IAuditedObject
|
||||
{
|
||||
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
|
||||
public override Guid Id { get; protected set; }
|
||||
public string Name { get; set; }
|
||||
public string? Logo { get; set; }
|
||||
public string? Color { get; set; }
|
||||
public bool IsDeleted { get; set; }
|
||||
public DateTime CreationTime { get; set; }
|
||||
|
||||
public Guid? CreatorId { get; set; }
|
||||
|
||||
public Guid? LastModifierId { get; set; }
|
||||
|
||||
public DateTime? LastModificationTime { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
using SqlSugar;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.Auditing;
|
||||
using Volo.Abp.Domain.Entities;
|
||||
using Yi.Framework.Rbac.Domain.Entities;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain.Entities.Forum
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 评论表
|
||||
/// </summary>
|
||||
[SugarTable("Comment")]
|
||||
public class CommentEntity : Entity<Guid>, ISoftDelete, IAuditedObject
|
||||
{
|
||||
/// <summary>
|
||||
/// 采用二维数组方式,不使用树形方式
|
||||
/// </summary>
|
||||
public CommentEntity()
|
||||
{
|
||||
}
|
||||
|
||||
public CommentEntity(Guid discussId)
|
||||
{
|
||||
DiscussId = discussId;
|
||||
}
|
||||
|
||||
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
|
||||
public override Guid Id { get; protected set; }
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
[SugarColumn(Length = 500)]
|
||||
public string Content { get; set; }
|
||||
|
||||
public Guid DiscussId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 被回复的CommentId
|
||||
/// </summary>
|
||||
public Guid ParentId { get; set; }
|
||||
public DateTime CreationTime { get; set; }
|
||||
|
||||
public Guid RootId { get; set; }
|
||||
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public List<CommentEntity> Children { get; set; } = new();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 用户,评论人用户信息
|
||||
/// </summary>
|
||||
[Navigate(NavigateType.OneToOne, nameof(CreatorId))]
|
||||
public UserEntity CreateUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 被评论的用户信息
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public UserEntity CommentedUser { get; set; }
|
||||
|
||||
public Guid? CreatorId { get; set; }
|
||||
|
||||
public Guid? LastModifierId { get; set; }
|
||||
|
||||
public DateTime? LastModificationTime { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
using SqlSugar;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.Auditing;
|
||||
using Volo.Abp.Domain.Entities;
|
||||
using Yi.Framework.Bbs.Domain.Shared.Enums;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain.Entities.Forum
|
||||
{
|
||||
[SugarTable("Discuss")]
|
||||
public class DiscussEntity : Entity<Guid>, ISoftDelete, IAuditedObject
|
||||
{
|
||||
public DiscussEntity()
|
||||
{
|
||||
}
|
||||
public DiscussEntity(Guid plateId)
|
||||
{
|
||||
PlateId = plateId;
|
||||
}
|
||||
|
||||
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
|
||||
public override Guid Id { get; protected set; }
|
||||
public string? Title { get; set; }
|
||||
public string? Types { get; set; }
|
||||
public string? Introduction { get; set; }
|
||||
public int AgreeNum { get; set; }
|
||||
public int SeeNum { get; set; }
|
||||
/// <summary>
|
||||
/// 封面
|
||||
/// </summary>
|
||||
public string? Cover { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString)]
|
||||
public string Content { get; set; }
|
||||
|
||||
public string? Color { get; set; }
|
||||
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
//是否置顶,默认false
|
||||
public bool IsTop { get; set; }
|
||||
|
||||
public int OrderNum { get; set; } = 0;
|
||||
|
||||
|
||||
public DiscussPermissionTypeEnum PermissionType { get; set; }
|
||||
|
||||
public Guid PlateId { get; set; }
|
||||
public DateTime CreationTime { get; set; }
|
||||
|
||||
public Guid? CreatorId { get; set; }
|
||||
|
||||
public Guid? LastModifierId { get; set; }
|
||||
|
||||
public DateTime? LastModificationTime { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 当PermissionType为部分用户时候,以下列表中的用户+创建者 代表拥有权限
|
||||
/// </summary>
|
||||
[SugarColumn(IsJson = true)]//使用json处理
|
||||
public List<Guid>? PermissionUserIds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否禁止评论创建功能
|
||||
/// </summary>
|
||||
public bool IsDisableCreateComment { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using SqlSugar;
|
||||
using Volo.Abp.Domain.Entities;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain.Entities.Forum
|
||||
{
|
||||
[SugarTable("DiscussMyType")]
|
||||
public class DiscussMyTypeEntity : Entity<Guid>
|
||||
{
|
||||
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
|
||||
public override Guid Id { get; protected set; }
|
||||
|
||||
public Guid DiscussId { get; set; }
|
||||
|
||||
public Guid MyTypeId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SqlSugar;
|
||||
using Volo.Abp.Auditing;
|
||||
using Volo.Abp.Domain.Entities;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain.Entities.Forum
|
||||
{
|
||||
/// <summary>
|
||||
/// 首页置顶主题
|
||||
/// </summary>
|
||||
[SugarTable("DiscussTop")]
|
||||
public class DiscussTopEntity : Entity<Guid>, IHasModificationTime
|
||||
{
|
||||
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
|
||||
public override Guid Id { get; protected set; }
|
||||
|
||||
public int OrderNum { get; set; }
|
||||
|
||||
public Guid DiscussId { get; set; }
|
||||
|
||||
public DateTime? LastModificationTime { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using SqlSugar;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.Domain.Entities;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain.Entities.Forum
|
||||
{
|
||||
[SugarTable("MyType")]
|
||||
public class MyTypeEntity : Entity<Guid>, ISoftDelete
|
||||
{
|
||||
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
|
||||
public override Guid Id { get; protected set; }
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public string? Color { get; set; }
|
||||
public string? BackgroundColor { get; set; }
|
||||
|
||||
public Guid UserId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using SqlSugar;
|
||||
using Volo.Abp.Domain.Entities;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.Auditing;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain.Entities.Forum
|
||||
{
|
||||
[SugarTable("Plate")]
|
||||
public class PlateEntity : Entity<Guid>, ISoftDelete, IAuditedObject
|
||||
{
|
||||
|
||||
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
|
||||
public override Guid Id { get; protected set; }
|
||||
|
||||
public string Code { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string? Logo { get; set; }
|
||||
public string? Introduction { get; set; }
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
|
||||
|
||||
public DateTime CreationTime { get; set; }
|
||||
|
||||
public Guid? CreatorId { get; set; }
|
||||
|
||||
public Guid? LastModifierId { get; set; }
|
||||
|
||||
public DateTime? LastModificationTime { get; set; }
|
||||
|
||||
public int OrderNum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否禁用创建主题,禁用后,只有管理员或者权限者能够发送
|
||||
/// </summary>
|
||||
public bool IsDisableCreateDiscuss { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user