feat: 完成子文章的操作

This commit is contained in:
陈淳
2023-03-12 19:49:08 +08:00
parent 1eac218910
commit 8e56667760
40 changed files with 569 additions and 337 deletions

View File

@@ -101,7 +101,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.FileManager",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.MultiTenancy", "src\framework\Yi.Framework.MultiTenancy\Yi.Framework.MultiTenancy.csproj", "{590B1EC0-CDA9-4937-BE07-FBB04437D21F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Framework.DictionaryManager", "Yi.Framework.DictionaryManager\Yi.Framework.DictionaryManager.csproj", "{8941B30D-698B-477A-8737-43E7B4A8695A}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Framework.DictionaryManager", "src\module\Yi.Framework.DictionaryManager\Yi.Framework.DictionaryManager.csproj", "{8941B30D-698B-477A-8737-43E7B4A8695A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@@ -13,6 +13,8 @@ using Yi.Framework.Core.Configuration;
using Yi.Framework.Core.Model;
using Yi.Framework.Core.Sqlsugar.Const;
using Yi.Framework.Core.Sqlsugar.Options;
using Yi.Framework.Data.Auditing;
using Yi.Framework.Data.Entities;
using DbType = SqlSugar.DbType;
namespace Yi.Framework.Core.Sqlsugar.Extensions
@@ -93,15 +95,46 @@ namespace Yi.Framework.Core.Sqlsugar.Extensions
}
db.Aop.DataExecuting = (oldValue, entityInfo) =>
{
//这里将进行审计日志
switch (entityInfo.OperationType)
{
case DataFilterType.InsertByObject:
break;
case DataFilterType.UpdateByObject:
if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.LastModificationTime)))
{
entityInfo.SetValue(DateTime.Now);
}
//if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.LastModifierId)))
//{
// if (_currentUser != null)
// {
// entityInfo.SetValue(_currentUser.Id);
// }
//}
break;
case DataFilterType.InsertByObject:
if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.CreationTime)))
{
entityInfo.SetValue(DateTime.Now);
}
//if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.CreatorId)))
//{
// if (_currentUser != null)
// {
// entityInfo.SetValue(_currentUser.Id);
// }
//}
//插入时需要租户id,先预留
if (entityInfo.PropertyName.Equals(nameof(IMultiTenant.TenantId)))
{
//if (this.CurrentTenant is not null)
//{
// entityInfo.SetValue(this.CurrentTenant.Id);
//}
}
break;
}
};
db.Aop.OnLogExecuting = (s, p) =>
{

View File

@@ -7,8 +7,8 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\src\framework\Yi.Framework.Data\Yi.Framework.Data.csproj" />
<ProjectReference Include="..\src\framework\Yi.Framework.Ddd\Yi.Framework.Ddd.csproj" />
<ProjectReference Include="..\..\framework\Yi.Framework.Data\Yi.Framework.Data.csproj" />
<ProjectReference Include="..\..\framework\Yi.Framework.Ddd\Yi.Framework.Ddd.csproj" />
</ItemGroup>
</Project>

View File

@@ -14,7 +14,7 @@ namespace Yi.BBS.Application.Contracts.Forum.Dtos.Discuss
public string Title { get; set; }
public string Types { get; set; }
public string? Introduction { get; set; }
public DateTime? CreateTime { get; set; }
public DateTime? CreateTime { get; set; } = DateTime.Now;
public string Content { get; set; }
public string? Color { get; set; }

View File

@@ -20,5 +20,7 @@ namespace Yi.BBS.Application.Contracts.Forum.Dtos.Discuss
public int SeeNum { get; set; }
public string Content { get; set; }
public string? Color { get; set; }
public long PlateId { get; set; }
}
}

View File

@@ -20,5 +20,7 @@ namespace Yi.BBS.Application.Contracts.Forum.Dtos
public int SeeNum { get; set; }
public string Content { get; set; }
public string? Color { get; set; }
public long PlateId { get; set; }
}
}

View File

@@ -11,7 +11,6 @@ namespace Yi.BBS.Application.Contracts.Forum.Dtos.Discuss
public string Title { get; set; }
public string Types { get; set; }
public string? Introduction { get; set; }
public DateTime? CreateTime { get; set; }
public int AgreeNum { get; set; }
public int SeeNum { get; set; }
public string Content { get; set; }

View File

@@ -40,6 +40,7 @@ namespace Yi.BBS.Application.Forum
var entities = await _DbQueryable
.WhereIF(!string.IsNullOrEmpty(input.Title), x => x.Title.Contains(input.Title))
.WhereIF(input.PlateId is not null, x => x.PlateId == input.PlateId)
.OrderByDescending(x => x.CreateTime)
.ToPageListAsync(input.PageNum, input.PageSize, total);
var items = await MapToGetListOutputDtosAsync(entities);
return new PagedResultDto<DiscussGetListOutputDto>(total, items);

View File

@@ -38,6 +38,7 @@ namespace Yi.BBS.Domain.Forum.Entities
/// <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);
}

View File

@@ -15,8 +15,8 @@
<PackageReference Include="UAParser" Version="3.1.47" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Yi.Framework.DictionaryManager\Yi.Framework.DictionaryManager.csproj" />
<ProjectReference Include="..\..\..\framework\Yi.Framework.Data\Yi.Framework.Data.csproj" />
<ProjectReference Include="..\..\..\module\Yi.Framework.DictionaryManager\Yi.Framework.DictionaryManager.csproj" />
<ProjectReference Include="..\..\..\module\Yi.Framework.EventBus\Yi.Framework.EventBus.csproj" />
<ProjectReference Include="..\..\..\module\Yi.Framework.FileManager\Yi.Framework.FileManager.csproj" />
<ProjectReference Include="..\..\..\module\Yi.Framework.OperLogManager\Yi.Framework.OperLogManager.csproj" />