|
@@ -214,6 +214,28 @@ namespace Hotline.Api.Controllers
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 名称检索热点树形
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="name"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ [HttpGet("treelist/children-hasname")]
|
|
|
|
+ public async Task<IReadOnlyList<KnowledgeHotSpotDto>> GetChildrenHasName([FromQuery] string Name, string? Attribution)
|
|
|
|
+ {
|
|
|
|
+ var arr = _hotspotTypeRepository.Queryable()
|
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(Name), x => x.HotSpotFullName.Contains(Name)).Select(x => x.Id).ToList().Cast<object>().ToArray();
|
|
|
|
+ //.ToTreeAsync(x => x.Children, it => it.ParentId, null);
|
|
|
|
+ return await _hotspotTypeRepository.Queryable().Select(x => new KnowledgeHotSpotDto
|
|
|
|
+ {
|
|
|
|
+ Id = x.Id.SelectAll(),
|
|
|
|
+ HasChild = SqlFunc.Subqueryable<Hotspot>().Where(d => d.ParentId == x.Id).NotAny(),
|
|
|
|
+ KnowledgeNum = SqlFunc.Subqueryable<Knowledge>().LeftJoin<Hotspot>((k, h) => k.HotspotId == h.Id)
|
|
|
|
+ .Where((k, h) => h.HotSpotFullName.StartsWith(x.HotSpotFullName))
|
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(Attribution), (k, h) => k.Attribution == Attribution).DistinctCount(k => k.Id)
|
|
|
|
+ }).ToTreeAsync(x => x.Children, it => it.ParentId, "", arr);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 知识分类- 只获取一级
|
|
/// 知识分类- 只获取一级
|
|
/// </summary>
|
|
/// </summary>
|