Merge branch 'refs/heads/abp' into digital-collectibles
This commit is contained in:
@@ -154,9 +154,10 @@ public class DefaultSqlSugarDbContext : SqlSugarDbContext
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case DataFilterType.DeleteByObject:
|
case DataFilterType.DeleteByObject:
|
||||||
if (entityInfo.PropertyName == nameof(IEntity<object>.Id))
|
// if (entityInfo.PropertyName == nameof(IEntity<object>.Id))
|
||||||
{
|
// {
|
||||||
//这里sqlsugar有个特殊,删除会返回批量的结果
|
//这里sqlsugar有个特殊,删除会返回批量的结果
|
||||||
|
//这里sqlsugar有第二个特殊,删除事件是行级事件
|
||||||
if (entityInfo.EntityValue is IEnumerable entityValues)
|
if (entityInfo.EntityValue is IEnumerable entityValues)
|
||||||
{
|
{
|
||||||
foreach (var entityValue in entityValues)
|
foreach (var entityValue in entityValues)
|
||||||
@@ -164,7 +165,7 @@ public class DefaultSqlSugarDbContext : SqlSugarDbContext
|
|||||||
EntityChangeEventHelper.PublishEntityDeletedEvent(entityValue);
|
EntityChangeEventHelper.PublishEntityDeletedEvent(entityValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
|
|||||||
|
|
||||||
|
|
||||||
var entities = await _articleRepository.GetTreeAsync(x => x.DiscussId == discussId);
|
var entities = await _articleRepository.GetTreeAsync(x => x.DiscussId == discussId);
|
||||||
//var result = entities.Tile();
|
|
||||||
var items = entities.Adapt<List<ArticleAllOutputDto>>();
|
var items = entities.Adapt<List<ArticleAllOutputDto>>();
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,8 +72,7 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
|
|||||||
.Select((discuss, user, info, plate) => new DiscussGetOutputDto
|
.Select((discuss, user, info, plate) => new DiscussGetOutputDto
|
||||||
{
|
{
|
||||||
Id = discuss.Id,
|
Id = discuss.Id,
|
||||||
IsAgree = SqlFunc.Subqueryable<AgreeEntity>().WhereIF(CurrentUser.Id != null,
|
IsAgree = false,
|
||||||
x => x.CreatorId == CurrentUser.Id && x.DiscussId == discuss.Id).Any(),
|
|
||||||
User = new BbsUserGetListOutputDto()
|
User = new BbsUserGetListOutputDto()
|
||||||
{
|
{
|
||||||
UserName = user.UserName,
|
UserName = user.UserName,
|
||||||
@@ -94,15 +93,25 @@ namespace Yi.Framework.Bbs.Application.Services.Forum
|
|||||||
Logo = plate.Logo
|
Logo = plate.Logo
|
||||||
}
|
}
|
||||||
}, true)
|
}, true)
|
||||||
.SingleAsync(discuss => discuss.Id == id);
|
.FirstAsync(discuss => discuss.Id == id);
|
||||||
|
|
||||||
if (item is not null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
await VerifyDiscussPermissionAsync(item.Id);
|
throw new UserFriendlyException("该主题不存在", "404");
|
||||||
await _localEventBus.PublishAsync(new SeeDiscussEventArgs
|
|
||||||
{ DiscussId = item.Id, OldSeeNum = item.SeeNum });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//组装点赞
|
||||||
|
var agreeCreatorList =
|
||||||
|
(await _agreeRepository._DbQueryable.Where(x => x.DiscussId == item.Id).Select(x=>x.CreatorId).ToListAsync());
|
||||||
|
//已登录
|
||||||
|
if (CurrentUser.Id is not null)
|
||||||
|
{
|
||||||
|
item.IsAgree = agreeCreatorList.Contains(CurrentUser.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
await VerifyDiscussPermissionAsync(item.Id);
|
||||||
|
await _localEventBus.PublishAsync(new SeeDiscussEventArgs
|
||||||
|
{ DiscussId = item.Id, OldSeeNum = item.SeeNum });
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,12 @@ namespace Yi.Framework.Bbs.Domain.Entities.Forum
|
|||||||
{
|
{
|
||||||
[SugarTable("Discuss")]
|
[SugarTable("Discuss")]
|
||||||
[SugarIndex($"index_{nameof(Title)}", nameof(Title), OrderByType.Asc)]
|
[SugarIndex($"index_{nameof(Title)}", nameof(Title), OrderByType.Asc)]
|
||||||
[SugarIndex($"index_{nameof(PlateId)}", nameof(PlateId), OrderByType.Asc)]
|
|
||||||
[SugarIndex($"index_{nameof(CreatorId)}", nameof(CreatorId), OrderByType.Asc)]
|
|
||||||
[SugarIndex($"index_{nameof(CreationTime)}", nameof(CreationTime), OrderByType.Desc)]
|
[SugarIndex($"index_{nameof(CreationTime)}", nameof(CreationTime), OrderByType.Desc)]
|
||||||
|
[SugarIndex($"index_{nameof(IsDeleted)}_{nameof(PlateId)}_{nameof(CreatorId)}",
|
||||||
|
nameof(IsDeleted), OrderByType.Asc,
|
||||||
|
nameof(PlateId), OrderByType.Asc,
|
||||||
|
nameof(CreatorId), OrderByType.Asc
|
||||||
|
)]
|
||||||
public class DiscussAggregateRoot : AggregateRoot<Guid>, ISoftDelete, IAuditedObject
|
public class DiscussAggregateRoot : AggregateRoot<Guid>, ISoftDelete, IAuditedObject
|
||||||
{
|
{
|
||||||
public DiscussAggregateRoot()
|
public DiscussAggregateRoot()
|
||||||
|
|||||||
Reference in New Issue
Block a user