chore: 构建稳定版本
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
using SqlSugar;
|
||||
using Volo.Abp.Auditing;
|
||||
using Volo.Abp.Domain.Entities;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain.Entities
|
||||
{
|
||||
[SugarTable("AccessLog")]
|
||||
public class AccessLogEntity : Entity<Guid>, IHasModificationTime, IHasCreationTime
|
||||
{
|
||||
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
|
||||
public override Guid Id { get; protected set; }
|
||||
public long Number { get; set; }
|
||||
public DateTime? LastModificationTime { get; set; }
|
||||
public DateTime CreationTime { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using SqlSugar;
|
||||
using Volo.Abp.Auditing;
|
||||
using Volo.Abp.Domain.Entities;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain.Entities
|
||||
{
|
||||
[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,56 @@
|
||||
using SqlSugar;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.Domain.Entities;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain.Entities
|
||||
{
|
||||
[SugarTable("Article")]
|
||||
public class ArticleEntity : Entity<Guid>, ISoftDelete
|
||||
{
|
||||
[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 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
|
||||
{
|
||||
[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,65 @@
|
||||
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
|
||||
{
|
||||
|
||||
/// <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; }
|
||||
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,61 @@
|
||||
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
|
||||
{
|
||||
[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 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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using SqlSugar;
|
||||
using Volo.Abp.Domain.Entities;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain.Entities
|
||||
{
|
||||
[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,20 @@
|
||||
using SqlSugar;
|
||||
using Volo.Abp;
|
||||
using Volo.Abp.Domain.Entities;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain.Entities
|
||||
{
|
||||
[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,18 @@
|
||||
using SqlSugar;
|
||||
using Volo.Abp.Domain.Entities;
|
||||
using Volo.Abp;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain.Entities
|
||||
{
|
||||
[SugarTable("Plate")]
|
||||
public class PlateEntity : Entity<Guid>, ISoftDelete
|
||||
{
|
||||
|
||||
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
|
||||
public override Guid Id { get; protected set; }
|
||||
public string Name { get; set; }
|
||||
public string? Logo { get; set; }
|
||||
public string? Introduction { get; set; }
|
||||
public bool IsDeleted { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using SqlSugar;
|
||||
using Volo.Abp.Domain.Entities;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain.Entities
|
||||
{
|
||||
[SugarTable("Setting")]
|
||||
public class SettingEntity : Entity<Guid>
|
||||
{
|
||||
|
||||
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
|
||||
public override Guid Id { get; protected 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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using Volo.Abp.Domain.Services;
|
||||
using Yi.Framework.Bbs.Domain.Entities;
|
||||
using Yi.Framework.SqlSugarCore.Abstractions;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain.Managers
|
||||
{
|
||||
/// <summary>
|
||||
/// 论坛模块的领域服务
|
||||
/// </summary>
|
||||
public class ForumManager : DomainService
|
||||
{
|
||||
public readonly ISqlSugarRepository<DiscussEntity,Guid> _discussRepository;
|
||||
public readonly ISqlSugarRepository<PlateEntity, Guid> _plateEntityRepository;
|
||||
public readonly ISqlSugarRepository<CommentEntity, Guid> _commentRepository;
|
||||
public ForumManager(ISqlSugarRepository<DiscussEntity, Guid> discussRepository, ISqlSugarRepository<PlateEntity, Guid> plateEntityRepository, ISqlSugarRepository<CommentEntity, Guid> commentRepository)
|
||||
{
|
||||
_discussRepository = discussRepository;
|
||||
_plateEntityRepository = plateEntityRepository;
|
||||
_commentRepository = commentRepository;
|
||||
}
|
||||
|
||||
//主题是不能直接创建的,需要由领域服务统一创建
|
||||
public async Task<DiscussEntity> CreateDiscussAsync(DiscussEntity entity)
|
||||
{
|
||||
entity.CreationTime = DateTime.Now;
|
||||
entity.AgreeNum = 0;
|
||||
entity.SeeNum = 0;
|
||||
return await _discussRepository.InsertReturnEntityAsync(entity);
|
||||
}
|
||||
|
||||
public async Task<CommentEntity> CreateCommentAsync(Guid discussId, Guid parentId, Guid rootId, string content)
|
||||
{
|
||||
var entity = new CommentEntity(discussId);
|
||||
entity.Content = content;
|
||||
entity.ParentId = parentId;
|
||||
entity.RootId = rootId;
|
||||
return await _commentRepository.InsertReturnEntityAsync(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Bbs.Domain.Entities;
|
||||
using Yi.Framework.SqlSugarCore.Abstractions;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain.Repositories
|
||||
{
|
||||
public interface IArticleRepository: ISqlSugarRepository<ArticleEntity,Guid>
|
||||
{
|
||||
Task<List<ArticleEntity>> GetTreeAsync(Expression<Func<ArticleEntity, bool>> where);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\..\..\common.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\rbac\Yi.Framework.Rbac.Domain\Yi.Framework.Rbac.Domain.csproj" />
|
||||
<ProjectReference Include="..\Yi.Framework.Bbs.Domain.Shared\Yi.Framework.Bbs.Domain.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>Yi.Framework.Bbs.Domain</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="P:Yi.Framework.Bbs.Domain.Entities.AgreeEntity.DiscussId">
|
||||
<summary>
|
||||
主题id
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Bbs.Domain.Entities.AgreeEntity.CreatorId">
|
||||
<summary>
|
||||
创建者
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.Bbs.Domain.Entities.ArticleEntityExtensions.Tile(System.Collections.Generic.List{Yi.Framework.Bbs.Domain.Entities.ArticleEntity})">
|
||||
<summary>
|
||||
平铺自己
|
||||
</summary>
|
||||
<param name="entities"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Yi.Framework.Bbs.Domain.Entities.CommentEntity">
|
||||
<summary>
|
||||
评论表
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Yi.Framework.Bbs.Domain.Entities.CommentEntity.#ctor">
|
||||
<summary>
|
||||
采用二维数组方式,不使用树形方式
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Bbs.Domain.Entities.CommentEntity.ParentId">
|
||||
<summary>
|
||||
被回复的CommentId
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Bbs.Domain.Entities.CommentEntity.CreateUser">
|
||||
<summary>
|
||||
用户,评论人用户信息
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Bbs.Domain.Entities.CommentEntity.CommentedUser">
|
||||
<summary>
|
||||
被评论的用户信息
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Bbs.Domain.Entities.DiscussEntity.Cover">
|
||||
<summary>
|
||||
封面
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Bbs.Domain.Entities.DiscussEntity.PermissionUserIds">
|
||||
<summary>
|
||||
当PermissionType为部分用户时候,以下列表中的用户+创建者 代表拥有权限
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.Framework.Bbs.Domain.Managers.ForumManager">
|
||||
<summary>
|
||||
论坛模块的领域服务
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
@@ -0,0 +1,16 @@
|
||||
using Volo.Abp.Modularity;
|
||||
using Yi.Framework.Bbs.Domain.Shared;
|
||||
using Yi.Framework.Rbac.Domain;
|
||||
|
||||
namespace Yi.Framework.Bbs.Domain
|
||||
{
|
||||
[DependsOn(
|
||||
typeof(YiFrameworkBbsDomainSharedModule),
|
||||
|
||||
typeof(YiFrameworkRbacDomainModule)
|
||||
)]
|
||||
public class YiFrameworkBbsDomainModule : AbpModule
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user