更改逻辑删除问题

This commit is contained in:
橙子
2023-01-27 16:21:35 +08:00
parent c7e74774de
commit 0a003359ea
33 changed files with 633 additions and 16 deletions

View File

@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Core.Attributes;
@@ -64,7 +65,7 @@ namespace Yi.Framework.Core.Sqlsugar.Repositories
}
public override async Task<bool> DeleteAsync(List<T> deleteObjs)
{
if (typeof(T) is ISoftDelete)
if (typeof(ISoftDelete).IsAssignableFrom(typeof(T)))
{
//反射赋值
deleteObjs.ForEach(e => ReflexHelper.SetModelValue(nameof(ISoftDelete.IsDeleted), true, e));
@@ -77,7 +78,7 @@ namespace Yi.Framework.Core.Sqlsugar.Repositories
}
public override async Task<bool> DeleteAsync(Expression<Func<T, bool>> whereExpression)
{
if (typeof(T) is ISoftDelete)
if (typeof(ISoftDelete).IsAssignableFrom(typeof(T)))
{
var entities = await GetListAsync(whereExpression);
//反射赋值
@@ -91,8 +92,8 @@ namespace Yi.Framework.Core.Sqlsugar.Repositories
}
public override async Task<bool> DeleteByIdAsync(dynamic id)
{
if (typeof(T) is ISoftDelete)
{
if (typeof(ISoftDelete).IsAssignableFrom(typeof(T)))
{
var entity = await GetByIdAsync(id);
//反射赋值
ReflexHelper.SetModelValue(nameof(ISoftDelete.IsDeleted), true, entity);
@@ -106,9 +107,13 @@ namespace Yi.Framework.Core.Sqlsugar.Repositories
}
public override async Task<bool> DeleteByIdsAsync(dynamic[] ids)
{
if (typeof(T) is ISoftDelete)
if (typeof(ISoftDelete).IsAssignableFrom(typeof(T)))
{
var entities = await _DbQueryable.In(ids).ToListAsync();
if (entities.Count == 0)
{
return false;
}
//反射赋值
entities.ForEach(e => ReflexHelper.SetModelValue(nameof(ISoftDelete.IsDeleted), true, e));
return await UpdateRangeAsync(entities);

View File

@@ -8,6 +8,6 @@ namespace Yi.Framework.Ddd.Services.Abstract
{
public interface IDeleteAppService<in TKey> : IApplicationService
{
Task DeleteAsync(TKey id);
Task<bool> DeleteAsync(string id);
}
}

View File

@@ -1,5 +1,7 @@
using System;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -104,20 +106,40 @@ namespace Yi.Framework.Ddd.Services
}
/// <summary>
/// 删
/// 单、多
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
public async Task DeleteAsync(TKey id)
public async Task<bool> DeleteAsync(string id)
{
if (id is null)
{
throw new ArgumentNullException(nameof(id));
}
await _repository.DeleteByIdAsync(id);
var idsValue = id.Split(',');
if (idsValue is null || idsValue.Length == 0)
{
throw new ArgumentNullException(nameof(id));
}
return await _repository.DeleteByIdsAsync(idsValue.Select(x => (object)x!).ToArray());
}
///// <summary>
///// 删
///// </summary>
///// <param name="id"></param>
///// <returns></returns>
///// <exception cref="ArgumentNullException"></exception>
//public async Task<bool> DeleteAsync(TKey id)
//{
// if (id is null)
// {
// throw new ArgumentNullException(nameof(id));
// }
// return await _repository.DeleteByIdAsync(id);
//}
/// <summary>
/// 改
/// </summary>
@@ -131,7 +153,7 @@ namespace Yi.Framework.Ddd.Services
{
throw new ArgumentNullException(nameof(id));
}
var entity = await MapToEntityAsync(input);
entity.Id = id;
await _repository.UpdateIgnoreNullAsync(entity);

View File

@@ -11,9 +11,9 @@
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Ddd.Services.CrudAppService`7.DeleteAsync(`3)">
<member name="M:Yi.Framework.Ddd.Services.CrudAppService`7.DeleteAsync(System.String)">
<summary>
单、多
</summary>
<param name="id"></param>
<returns></returns>

View File

@@ -16,7 +16,7 @@ TemplateFactory templateFactory = new();
//List<string> entityNames = new() { "Banner" };
string modelName = "Forum";
string nameSpaces = "Yi.BBS";
List<string> entityNames = new() { "Comment" };
List<string> entityNames = new() { "_" };

View File

@@ -14,6 +14,11 @@
Banner抽象
</summary>
</member>
<member name="T:Yi.BBS.Application.Contracts.Forum.Dtos.ArticleCreateInputVo">
<summary>
Article输入创建对象
</summary>
</member>
<member name="T:Yi.BBS.Application.Contracts.Forum.Dtos.CommentCreateInputVo">
<summary>
Comment输入创建对象
@@ -24,11 +29,21 @@
Discuss输入创建对象
</summary>
</member>
<member name="T:Yi.BBS.Application.Contracts.Forum.Dtos.MyTypeCreateInputVo">
<summary>
Label输入创建对象
</summary>
</member>
<member name="T:Yi.BBS.Application.Contracts.Forum.Dtos.Plate.PlateCreateInputVo">
<summary>
Plate输入创建对象
</summary>
</member>
<member name="T:Yi.BBS.Application.Contracts.Forum.IArticleService">
<summary>
Article服务抽象
</summary>
</member>
<member name="T:Yi.BBS.Application.Contracts.Forum.ICommentService">
<summary>
Comment服务抽象
@@ -39,6 +54,11 @@
Discuss服务抽象
</summary>
</member>
<member name="T:Yi.BBS.Application.Contracts.Forum.ILabelService">
<summary>
Label服务抽象
</summary>
</member>
<member name="T:Yi.BBS.Application.Contracts.Forum.IPlateService">
<summary>
Plate服务抽象

View File

@@ -9,6 +9,27 @@
Banner服务实现
</summary>
</member>
<member name="T:Yi.BBS.Application.Forum.ArticleService">
<summary>
Article服务实现
</summary>
</member>
<member name="M:Yi.BBS.Application.Forum.ArticleService.GetDiscussIdAsync(System.Int64)">
<summary>
查询文章
</summary>
<param name="discussId"></param>
<returns></returns>
<exception cref="T:Yi.Framework.Core.Exceptions.UserFriendlyException"></exception>
</member>
<member name="M:Yi.BBS.Application.Forum.ArticleService.CreateAsync(Yi.BBS.Application.Contracts.Forum.Dtos.ArticleCreateInputVo)">
<summary>
发表文章
</summary>
<param name="input"></param>
<returns></returns>
<exception cref="T:Yi.Framework.Core.Exceptions.UserFriendlyException"></exception>
</member>
<member name="T:Yi.BBS.Application.Forum.CommentService">
<summary>
Comment服务实现
@@ -50,6 +71,25 @@
<param name="input"></param>
<returns></returns>
</member>
<member name="T:Yi.BBS.Application.Forum.MyTypeService">
<summary>
Label服务实现
</summary>
</member>
<member name="M:Yi.BBS.Application.Forum.MyTypeService.GetListCurrentAsync(Yi.BBS.Application.Contracts.Forum.Dtos.MyTypeGetListInputVo)">
<summary>
获取当前用户的主题类型
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.BBS.Application.Forum.MyTypeService.CreateAsync(Yi.BBS.Application.Contracts.Forum.Dtos.MyTypeCreateInputVo)">
<summary>
创建
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="T:Yi.BBS.Application.Forum.PlateService">
<summary>
Plate服务实现

View File

@@ -5,7 +5,6 @@ using Yi.Framework.Core.Extensions;
using Yi.BBS.Web;
using Yi.BBS.Application;
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.UseStartUrlsServer(builder.Configuration);

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.BBS.Application.Contracts.Forum.Dtos
{
/// <summary>
/// Article输入创建对象
/// </summary>
public class ArticleCreateInputVo
{
public string Content { get; set; }
public string Name { get; set; }
public long DiscussId { get; set; }
public long ParentId { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Ddd.Dtos;
namespace Yi.BBS.Application.Contracts.Forum.Dtos
{
public class ArticleGetListInputVo : PagedAndSortedResultRequestDto
{
public long Id { get; set; }
public string Content { get; set; }
public string Name { get; set; }
public long DiscussId { get; set; }
public long ParentId { get; set; }
}
}

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Ddd.Dtos;
namespace Yi.BBS.Application.Contracts.Forum.Dtos
{
public class ArticleGetListOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public string Content { get; set; }
public string Name { get; set; }
public long DiscussId { get; set; }
public long ParentId { get; set; }
public List<ArticleGetListOutputDto> Children { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Ddd.Dtos;
namespace Yi.BBS.Application.Contracts.Forum.Dtos
{
public class ArticleGetOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public string Content { get; set; }
public string Name { get; set; }
public long DiscussId { get; set; }
public long ParentId { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.BBS.Application.Contracts.Forum.Dtos
{
public class ArticleUpdateInputVo
{
public long Id { get; set; }
public string Content { get; set; }
public string Name { get; set; }
public long DiscussId { get; set; }
public long ParentId { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.BBS.Application.Contracts.Forum.Dtos
{
/// <summary>
/// Label输入创建对象
/// </summary>
public class MyTypeCreateInputVo
{
public string Name { get; set; }
public string? Color { get; set; }
public string? BackgroundColor { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Ddd.Dtos;
namespace Yi.BBS.Application.Contracts.Forum.Dtos
{
public class MyTypeGetListInputVo : PagedAndSortedResultRequestDto
{
public long Id { 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 System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Ddd.Dtos;
namespace Yi.BBS.Application.Contracts.Forum.Dtos
{
public class MyTypeGetListOutputDto : IEntityDto<long>
{
public long Id { 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 System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Ddd.Dtos;
namespace Yi.BBS.Application.Contracts.Forum.Dtos
{
public class MyTypeOutputDto : IEntityDto<long>
{
public long Id { 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,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.BBS.Application.Contracts.Forum.Dtos
{
public class MyTypeUpdateInputVo
{
public long Id { 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 System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.BBS.Application.Contracts.Forum.Dtos;
using Yi.Framework.Ddd.Services.Abstract;
namespace Yi.BBS.Application.Contracts.Forum
{
/// <summary>
/// Article服务抽象
/// </summary>
public interface IArticleService : ICrudAppService<ArticleGetOutputDto, ArticleGetListOutputDto, long, ArticleGetListInputVo, ArticleCreateInputVo, ArticleUpdateInputVo>
{
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.BBS.Application.Contracts.Forum.Dtos;
using Yi.Framework.Ddd.Services.Abstract;
namespace Yi.BBS.Application.Contracts.Forum
{
/// <summary>
/// Label服务抽象
/// </summary>
public interface ILabelService : ICrudAppService<MyTypeOutputDto, MyTypeGetListOutputDto, long, MyTypeGetListInputVo, MyTypeCreateInputVo, MyTypeUpdateInputVo>
{
}
}

View File

@@ -0,0 +1,64 @@
using Yi.BBS.Application.Contracts.Forum;
using NET.AutoWebApi.Setting;
using Yi.BBS.Application.Contracts.Forum.Dtos;
using Yi.BBS.Domain.Forum.Entities;
using Yi.Framework.Ddd.Services;
using Yi.Framework.Ddd.Dtos;
using Microsoft.AspNetCore.Mvc;
using Yi.BBS.Domain.Forum.Repositories;
using Yi.Framework.Ddd.Repositories;
using Yi.BBS.Domain.Shared.Forum.ConstClasses;
namespace Yi.BBS.Application.Forum
{
/// <summary>
/// Article服务实现
/// </summary>
[AppService]
public class ArticleService : CrudAppService<ArticleEntity, ArticleGetOutputDto, ArticleGetListOutputDto, long, ArticleGetListInputVo, ArticleCreateInputVo, ArticleUpdateInputVo>,
IArticleService, IAutoApiService
{
[Autowired]
private IArticleRepository _articleRepository { get; set; }
[Autowired]
private IRepository<DiscussEntity> _discussRepository { get; set; }
/// <summary>
/// 查询文章
/// </summary>
/// <param name="discussId"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
public async Task<List<ArticleGetListOutputDto>> GetDiscussIdAsync([FromRoute] long discussId)
{
if (!await _discussRepository.IsAnyAsync(x => x.Id == discussId))
{
throw new UserFriendlyException(DiscussConst.);
}
var entities = await _articleRepository.GetTreeAsync(x=>x.DiscussId==discussId);
var items = await MapToGetListOutputDtosAsync(entities);
return items;
}
/// <summary>
/// 发表文章
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
public async override Task<ArticleGetOutputDto> CreateAsync(ArticleCreateInputVo input)
{
if (!await _discussRepository.IsAnyAsync(x => x.Id == input.DiscussId))
{
throw new UserFriendlyException(DiscussConst.);
}
if (input.ParentId != 0 && !await _repository.IsAnyAsync(x => x.Id == input.ParentId))
{
throw new UserFriendlyException(ArticleConst.);
}
return await base.CreateAsync(input);
}
}
}

View File

@@ -0,0 +1,23 @@
using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.BBS.Application.Contracts.Forum.Dtos;
using Yi.BBS.Domain.Forum.Entities;
namespace Yi.BBS.Application.Forum.MapperConfig
{
public class ArticleProfile: Profile
{
public ArticleProfile()
{
CreateMap<ArticleGetListInputVo, ArticleEntity>();
CreateMap<ArticleCreateInputVo, ArticleEntity>();
CreateMap<ArticleUpdateInputVo, ArticleEntity>();
CreateMap<ArticleEntity, ArticleGetListOutputDto>();
CreateMap<ArticleEntity, ArticleGetOutputDto>();
}
}
}

View File

@@ -0,0 +1,23 @@
using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.BBS.Application.Contracts.Forum.Dtos;
using Yi.BBS.Domain.Forum.Entities;
namespace Yi.BBS.Application.Forum.MapperConfig
{
public class MyTypeProfile: Profile
{
public MyTypeProfile()
{
CreateMap<MyTypeGetListInputVo, MyTypeEntity>();
CreateMap<MyTypeCreateInputVo, MyTypeEntity>();
CreateMap<MyTypeUpdateInputVo, MyTypeEntity>();
CreateMap<MyTypeEntity, MyTypeGetListOutputDto>();
CreateMap<MyTypeEntity, MyTypeOutputDto>();
}
}
}

View File

@@ -0,0 +1,53 @@
using Yi.BBS.Application.Contracts.Forum;
using NET.AutoWebApi.Setting;
using Yi.BBS.Application.Contracts.Forum.Dtos;
using Yi.BBS.Domain.Forum.Entities;
using Yi.Framework.Ddd.Services;
using Yi.Framework.Core.CurrentUsers;
using SqlSugar;
using Yi.Framework.Ddd.Dtos;
using Yi.Framework.Data.Filters;
namespace Yi.BBS.Application.Forum
{
/// <summary>
/// Label服务实现
/// </summary>
[AppService]
public class MyTypeService : CrudAppService<MyTypeEntity, MyTypeOutputDto, MyTypeGetListOutputDto, long, MyTypeGetListInputVo, MyTypeCreateInputVo, MyTypeUpdateInputVo>,
ILabelService, IAutoApiService
{
[Autowired]
private ICurrentUser _currentUser { get; set; }
[Autowired]
private IDataFilter _dataFilter { get; set; }
/// <summary>
/// 获取当前用户的主题类型
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public Task<PagedResultDto<MyTypeGetListOutputDto>> GetListCurrentAsync(MyTypeGetListInputVo input)
{
_dataFilter.AddFilter<MyTypeEntity>(x => x.UserId == _currentUser.Id);
return base.GetListAsync(input);
}
/// <summary>
/// 创建
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public override async Task<MyTypeOutputDto> CreateAsync(MyTypeCreateInputVo input)
{
var entity = await MapToEntityAsync(input);
entity.Id = SnowflakeHelper.NextId;
entity.UserId = _currentUser.Id;
entity.IsDeleted = false;
var outputEntity = await _repository.InsertReturnEntityAsync(entity);
return await MapToGetOutputDtoAsync(outputEntity);
}
}
}

View File

@@ -62,7 +62,7 @@ namespace Yi.BBS.Application.GlobalSetting
{
var dto = new List<ActionJwtDto>();
dto.Add(new ActionJwtDto { Router = "/index", ActionName = "首页" });
//dto.Add(new ActionJwtDto { Router = "", ActionName = "" });
//dto.Add(new ActionJwtDto { Router = "/admLable", ActionName = "标签管理" });
//dto.Add(new ActionJwtDto { Router = "", ActionName = "" });
//dto.Add(new ActionJwtDto { Router = "", ActionName = "" });
//dto.Add(new ActionJwtDto { Router = "", ActionName = "" });

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.BBS.Domain.Shared.Forum.ConstClasses
{
/// <summary>
/// 常量定义
/// </summary>
public class ArticleConst
{
public const string = "传入的文章id不存在";
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.BBS.Domain.Shared.Forum.ConstClasses
{
/// <summary>
/// 常量定义
/// </summary>
public class LabelConst
{
}
}

View File

@@ -0,0 +1,29 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Data.Entities;
using Yi.Framework.Ddd.Entities;
namespace Yi.BBS.Domain.Forum.Entities
{
[SugarTable("Article")]
public class ArticleEntity : IEntity<long>, ISoftDelete
{
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; set; }
public bool IsDeleted { get; set; }
public string Content { get; set; }
public string Name { get; set; }
public long DiscussId { get; set; }
public long ParentId { get; set; }
public List<ArticleEntity> Children { 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.Ddd.Entities;
namespace Yi.BBS.Domain.Forum.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,25 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Data.Entities;
using Yi.Framework.Ddd.Entities;
namespace Yi.BBS.Domain.Forum.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,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Yi.BBS.Domain.Forum.Entities;
using Yi.Framework.Ddd.Repositories;
namespace Yi.BBS.Domain.Forum.Repositories
{
public interface IArticleRepository:IRepository<ArticleEntity>
{
Task<List<ArticleEntity>> GetTreeAsync(Expression<Func<ArticleEntity, bool>> where);
}
}

View File

@@ -0,0 +1,27 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Yi.BBS.Domain.Forum.Entities;
using Yi.BBS.Domain.Forum.Repositories;
using Yi.Framework.Core.Sqlsugar.Repositories;
using Yi.Framework.Ddd.Repositories;
namespace Yi.BBS.Sqlsugar.Repositories
{
[AppService]
public class ArticleRepository : SqlsugarRepository<ArticleEntity>, IArticleRepository
{
public ArticleRepository(ISqlSugarClient context) : base(context)
{
}
public async Task<List<ArticleEntity>> GetTreeAsync(Expression<Func<ArticleEntity, bool>> where)
{
return await _DbQueryable.Where(where).ToTreeAsync(x => x.Children, x => x.ParentId, 0);
}
}
}