|
@@ -12,6 +12,9 @@ using Hotline.Share.Tools;
|
|
|
using Hotline.Share.Enums.Planlibrary;
|
|
|
using Hotline.Application.ExportWord;
|
|
|
using Hotline.Application.Tools;
|
|
|
+using Hotline.KnowledgeBase;
|
|
|
+using Hotline.Share.Dtos.Knowledge;
|
|
|
+using System.Data;
|
|
|
|
|
|
namespace Hotline.Api.Controllers
|
|
|
{
|
|
@@ -129,6 +132,30 @@ namespace Hotline.Api.Controllers
|
|
|
|
|
|
#region 预案库管理
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 预案库分类列表
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="IsEnable"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("list/treelist")]
|
|
|
+ public async Task<List<PlanTypeDto>> QueryAllPlanTypeTreeList(bool? IsEnable)
|
|
|
+ {
|
|
|
+ return await _planTypeRepository.Queryable()
|
|
|
+ .WhereIF(IsEnable.HasValue, x => x.IsEnable == IsEnable)
|
|
|
+ .Where(x => SqlFunc.Subqueryable<PlanTypeOrg>().Where(to => to.TypeId == x.Id).Any() ||
|
|
|
+ SqlFunc.Subqueryable<PlanTypeOrg>().Where(to => to.TypeId == x.Id).NotAny()
|
|
|
+ )
|
|
|
+ .Select(x => new PlanTypeDto()
|
|
|
+ {
|
|
|
+ Id = x.Id.SelectAll(),
|
|
|
+ PlanNum = SqlFunc.Subqueryable<PlanRelationType>().LeftJoin<PlanList>((kr, k) => kr.PlanId == k.Id)
|
|
|
+ .Where((kr, k) => kr.PlanTypeSpliceName.StartsWith(x.SpliceName))
|
|
|
+ .DistinctCount(kr => kr.PlanId)
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .OrderBy(x => x.Sort).ToTreeAsync(it => it.children, it => it.ParentId, null, it => it.Id);
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 预案库列表
|
|
|
/// </summary>
|
|
@@ -348,5 +375,28 @@ namespace Hotline.Api.Controllers
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
+ #region 预案库检索
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 预案库列表前10
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpGet("list/top10")]
|
|
|
+ public async Task<List<PlanPageViewDto>> QueryTop10PlanList()
|
|
|
+ {
|
|
|
+ return await _planListRepository.Queryable()
|
|
|
+ .Take(10)
|
|
|
+ .Where(x => x.Status == EPlanStatus.OnShelf)
|
|
|
+ .Select(x => new PlanPageViewDto
|
|
|
+ {
|
|
|
+ Id = x.Id,
|
|
|
+ Title = x.Title,
|
|
|
+ PageView = x.PageView
|
|
|
+ })
|
|
|
+ .OrderBy(x => x.PageView, OrderByType.Desc)
|
|
|
+ .ToListAsync();
|
|
|
+ }
|
|
|
+
|
|
|
+ #endregion
|
|
|
}
|
|
|
}
|