feat:全基础流程跑通

This commit is contained in:
橙子
2023-04-15 22:44:33 +08:00
parent 9b1a978cb5
commit 1655870d4d
151 changed files with 3120 additions and 209 deletions

View File

@@ -0,0 +1,35 @@
using System;
using SqlSugar;
using Yi.Framework.Infrastructure.Data.Auditing;
using Yi.Framework.Infrastructure.Ddd.Entities;
using Yi.Framework.Infrastructure.Helper;
namespace Yi.Furion.Core.Bbs.Entities
{
[SugarTable("Agree")]
public class AgreeEntity : IEntity<long>, ICreationAuditedObject
{
public AgreeEntity()
{
}
public AgreeEntity(long discussId)
{
DiscussId = discussId;
}
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; set; } = SnowflakeHelper.NextId;
public DateTime CreationTime { get; set; }
/// <summary>
/// 主题id
/// </summary>
public long DiscussId { get; set; }
/// <summary>
/// 创建者
/// </summary>
public long? CreatorId { get; set; }
}
}

View File

@@ -0,0 +1,58 @@
using System.Collections.Generic;
using System.Linq;
using SqlSugar;
using Yi.Framework.Infrastructure.Data.Entities;
using Yi.Framework.Infrastructure.Ddd.Entities;
namespace Yi.Furion.Core.Bbs.Entities
{
[SugarTable("Article")]
public class ArticleEntity : IEntity<long>, ISoftDelete
{
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; set; }
public bool IsDeleted { get; set; }
[SugarColumn(Length = 999999)]
public string Content { get; set; }
public string Name { get; set; }
public long DiscussId { get; set; }
public long ParentId { get; set; }
[SugarColumn(IsIgnore = true)]
public List<ArticleEntity> Children { get; set; }
}
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;
}
}
}

View File

@@ -0,0 +1,26 @@
using System;
using SqlSugar;
using Yi.Framework.Infrastructure.Data.Auditing;
using Yi.Framework.Infrastructure.Data.Entities;
using Yi.Framework.Infrastructure.Ddd.Entities;
namespace Yi.Furion.Core.Bbs.Entities
{
[SugarTable("Banner")]
public class BannerEntity : IEntity<long>, ISoftDelete, IAuditedObject
{
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; 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 long? CreatorId { get; set; }
public long? LastModifierId { get; set; }
public DateTime? LastModificationTime { get; set; }
}
}

View File

@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using SqlSugar;
using Yi.Framework.Infrastructure.Data.Auditing;
using Yi.Framework.Infrastructure.Data.Entities;
using Yi.Framework.Infrastructure.Ddd.Entities;
using Yi.Furion.Core.Rbac.Entities;
namespace Yi.Furion.Core.Bbs.Entities
{
/// <summary>
/// 评论表
/// </summary>
[SugarTable("Comment")]
public class CommentEntity : IEntity<long>, ISoftDelete, IAuditedObject
{
/// <summary>
/// 采用二维数组方式,不使用树形方式
/// </summary>
public CommentEntity()
{
}
public CommentEntity(long discussId)
{
DiscussId = discussId;
}
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; set; }
public bool IsDeleted { get; set; }
public string Content { get; set; }
public long DiscussId { get; set; }
/// <summary>
/// 被回复的CommentId
/// </summary>
public long ParentId { get; set; }
public DateTime CreationTime { get; set; }
public long 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 long? CreatorId { get; set; }
public long? LastModifierId { get; set; }
public DateTime? LastModificationTime { get; set; }
}
}

View File

@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using SqlSugar;
using Yi.Framework.Infrastructure.Data.Auditing;
using Yi.Framework.Infrastructure.Data.Entities;
using Yi.Framework.Infrastructure.Ddd.Entities;
using Yi.Furion.Core.Bbs.Enums;
namespace Yi.Furion.Core.Bbs.Entities
{
[SugarTable("Discuss")]
public class DiscussEntity : IEntity<long>, ISoftDelete, IAuditedObject
{
public DiscussEntity()
{
}
public DiscussEntity(long plateId)
{
PlateId = plateId;
}
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; 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(Length = 999999)]
public string Content { get; set; }
public string Color { get; set; }
public bool IsDeleted { get; set; }
//是否置顶默认false
public bool IsTop { get; set; }
public DiscussPermissionTypeEnum PermissionType { get; set; }
public long PlateId { get; set; }
public DateTime CreationTime { get; set; }
public long? CreatorId { get; set; }
public long? LastModifierId { get; set; }
public DateTime? LastModificationTime { get; set; }
/// <summary>
/// 当PermissionType为部分用户时候以下列表中的用户+创建者 代表拥有权限
/// </summary>
[SugarColumn(IsJson = true)]//使用json处理
public List<long> PermissionUserIds { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Infrastructure.Ddd.Entities;
namespace Yi.Furion.Core.Bbs.Entities
{
[SugarTable("DiscussMyType")]
public class DiscussMyTypeEntity : IEntity<long>
{
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; set; }
public long DiscussId { get; set; }
public long MyTypeId { get; set; }
}
}

View File

@@ -0,0 +1,20 @@
using SqlSugar;
using Yi.Framework.Infrastructure.Data.Entities;
using Yi.Framework.Infrastructure.Ddd.Entities;
namespace Yi.Furion.Core.Bbs.Entities
{
[SugarTable("MyType")]
public class MyTypeEntity : IEntity<long>, ISoftDelete
{
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; set; }
public bool IsDeleted { get; set; }
public string Name { get; set; }
public string Color { get; set; }
public string BackgroundColor { get; set; }
public long UserId { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using SqlSugar;
using Yi.Framework.Infrastructure.Data.Entities;
using Yi.Framework.Infrastructure.Ddd.Entities;
namespace Yi.Furion.Core.Bbs.Entities
{
[SugarTable("Plate")]
public class PlateEntity : IEntity<long>, ISoftDelete
{
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; set; }
public string Name { get; set; }
public string Logo { get; set; }
public string Introduction { get; set; }
public bool IsDeleted { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using SqlSugar;
using Yi.Framework.Infrastructure.Ddd.Entities;
namespace Yi.Furion.Core.Bbs.Entities
{
[SugarTable("Setting")]
public class SettingEntity : IEntity<long>
{
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; set; }
public int CommentPage { get; set; }
public int DiscussPage { get; set; }
public int CommentExperience { get; set; }
public int DiscussExperience { get; set; }
public string Title { get; set; }
}
}