|
@@ -1,4 +1,5 @@
|
|
using Hotline.Application.Knowledge;
|
|
using Hotline.Application.Knowledge;
|
|
|
|
+using Hotline.Configurations;
|
|
using Hotline.KnowledgeBase;
|
|
using Hotline.KnowledgeBase;
|
|
using Hotline.Repository.SqlSugar.Extensions;
|
|
using Hotline.Repository.SqlSugar.Extensions;
|
|
using Hotline.Settings;
|
|
using Hotline.Settings;
|
|
@@ -11,6 +12,7 @@ using Hotline.Share.Requests;
|
|
using Hotline.Tools;
|
|
using Hotline.Tools;
|
|
using MapsterMapper;
|
|
using MapsterMapper;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
+using Microsoft.Extensions.Options;
|
|
using SqlSugar;
|
|
using SqlSugar;
|
|
using XF.Domain.Authentications;
|
|
using XF.Domain.Authentications;
|
|
using XF.Domain.Exceptions;
|
|
using XF.Domain.Exceptions;
|
|
@@ -33,26 +35,28 @@ namespace Hotline.Api.Controllers
|
|
private readonly ISystemOrganizeRepository _systemOrganizeRepository;
|
|
private readonly ISystemOrganizeRepository _systemOrganizeRepository;
|
|
private readonly IRepository<Hotspot> _hotspotTypeRepository;
|
|
private readonly IRepository<Hotspot> _hotspotTypeRepository;
|
|
private readonly IKnowApplication _knowApplication;
|
|
private readonly IKnowApplication _knowApplication;
|
|
-
|
|
|
|
- /// <summary>
|
|
|
|
- ///
|
|
|
|
- /// </summary>
|
|
|
|
- /// <param name="knowledgeTypeRepository"></param>
|
|
|
|
- /// <param name="knowledgeTypeDomainService"></param>
|
|
|
|
- /// <param name="knowledgeStandardRepository"></param>
|
|
|
|
- /// <param name="sessionContext"></param>
|
|
|
|
- /// <param name="mapper"></param>
|
|
|
|
- /// <param name="systemOrganizeRepository"></param>
|
|
|
|
- /// <param name="hotspotTypeRepository"></param>
|
|
|
|
- /// <param name="knowApplication"></param>
|
|
|
|
- public KnowledgeCommonController(IRepository<KnowledgeType> knowledgeTypeRepository,
|
|
|
|
|
|
+ private readonly IOptionsSnapshot<AppConfiguration> _appOptions;
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ ///
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="knowledgeTypeRepository"></param>
|
|
|
|
+ /// <param name="knowledgeTypeDomainService"></param>
|
|
|
|
+ /// <param name="knowledgeStandardRepository"></param>
|
|
|
|
+ /// <param name="sessionContext"></param>
|
|
|
|
+ /// <param name="mapper"></param>
|
|
|
|
+ /// <param name="systemOrganizeRepository"></param>
|
|
|
|
+ /// <param name="hotspotTypeRepository"></param>
|
|
|
|
+ /// <param name="knowApplication"></param>
|
|
|
|
+ public KnowledgeCommonController(IRepository<KnowledgeType> knowledgeTypeRepository,
|
|
IKnowledgeTypeDomainService knowledgeTypeDomainService,
|
|
IKnowledgeTypeDomainService knowledgeTypeDomainService,
|
|
IRepository<KnowledgeStandard> knowledgeStandardRepository,
|
|
IRepository<KnowledgeStandard> knowledgeStandardRepository,
|
|
ISessionContext sessionContext,
|
|
ISessionContext sessionContext,
|
|
IMapper mapper,
|
|
IMapper mapper,
|
|
ISystemOrganizeRepository systemOrganizeRepository,
|
|
ISystemOrganizeRepository systemOrganizeRepository,
|
|
IRepository<Hotspot> hotspotTypeRepository,
|
|
IRepository<Hotspot> hotspotTypeRepository,
|
|
- IKnowApplication knowApplication)
|
|
|
|
|
|
+ IKnowApplication knowApplication,
|
|
|
|
+ IOptionsSnapshot<AppConfiguration> appOptions)
|
|
{
|
|
{
|
|
_knowledgeTypeRepository = knowledgeTypeRepository;
|
|
_knowledgeTypeRepository = knowledgeTypeRepository;
|
|
_knowledgeTypeDomainService = knowledgeTypeDomainService;
|
|
_knowledgeTypeDomainService = knowledgeTypeDomainService;
|
|
@@ -62,7 +66,9 @@ namespace Hotline.Api.Controllers
|
|
_systemOrganizeRepository = systemOrganizeRepository;
|
|
_systemOrganizeRepository = systemOrganizeRepository;
|
|
_hotspotTypeRepository = hotspotTypeRepository;
|
|
_hotspotTypeRepository = hotspotTypeRepository;
|
|
_knowApplication = knowApplication;
|
|
_knowApplication = knowApplication;
|
|
- }
|
|
|
|
|
|
+ _appOptions = appOptions;
|
|
|
|
+
|
|
|
|
+ }
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
#region 知识分类
|
|
#region 知识分类
|
|
@@ -157,6 +163,10 @@ namespace Hotline.Api.Controllers
|
|
[HttpGet("treelist")]
|
|
[HttpGet("treelist")]
|
|
public async Task<List<KnowledgeTypeDto>> GetTreeList(bool? isEnable, string? attribution, EKnowledgeStatus? status)
|
|
public async Task<List<KnowledgeTypeDto>> GetTreeList(bool? isEnable, string? attribution, EKnowledgeStatus? status)
|
|
{
|
|
{
|
|
|
|
+ if (_appOptions.Value.IsLuZhou)
|
|
|
|
+ {
|
|
|
|
+ attribution = string.Empty;
|
|
|
|
+ }
|
|
var isCenter = _sessionContext.OrgIsCenter;
|
|
var isCenter = _sessionContext.OrgIsCenter;
|
|
var query = _knowledgeTypeRepository.Queryable()
|
|
var query = _knowledgeTypeRepository.Queryable()
|
|
.WhereIF(isEnable.HasValue, x => x.IsEnable == isEnable);
|
|
.WhereIF(isEnable.HasValue, x => x.IsEnable == isEnable);
|
|
@@ -209,12 +219,15 @@ namespace Hotline.Api.Controllers
|
|
[HttpGet("treelist/org")]
|
|
[HttpGet("treelist/org")]
|
|
public async Task<List<KnowledgeOrgDto>> GetTreeList(string? Attribution)
|
|
public async Task<List<KnowledgeOrgDto>> GetTreeList(string? Attribution)
|
|
{
|
|
{
|
|
-
|
|
|
|
- //await Db.Queryable<SystemOrganize>()
|
|
|
|
- // .Where(it => it.Id.StartsWith(orgCode))
|
|
|
|
- // .OrderBy(d => d.Id)
|
|
|
|
- // .ToTreeAsync(it => it.Children, it => it.ParentId, orgCode.Length > 6 ? orgCode.Substring(0, orgCode.Length - 3) : null);
|
|
|
|
- var orgCode = _sessionContext.RequiredOrgId;
|
|
|
|
|
|
+ if (_appOptions.Value.IsLuZhou)
|
|
|
|
+ {
|
|
|
|
+ Attribution = string.Empty;
|
|
|
|
+ }
|
|
|
|
+ //await Db.Queryable<SystemOrganize>()
|
|
|
|
+ // .Where(it => it.Id.StartsWith(orgCode))
|
|
|
|
+ // .OrderBy(d => d.Id)
|
|
|
|
+ // .ToTreeAsync(it => it.Children, it => it.ParentId, orgCode.Length > 6 ? orgCode.Substring(0, orgCode.Length - 3) : null);
|
|
|
|
+ var orgCode = _sessionContext.RequiredOrgId;
|
|
var query = _systemOrganizeRepository.Queryable().WhereIF(!_sessionContext.OrgIsCenter, it => it.Id.StartsWith(_sessionContext.RequiredOrgId))
|
|
var query = _systemOrganizeRepository.Queryable().WhereIF(!_sessionContext.OrgIsCenter, it => it.Id.StartsWith(_sessionContext.RequiredOrgId))
|
|
.Select(it => new KnowledgeOrgDto()
|
|
.Select(it => new KnowledgeOrgDto()
|
|
{
|
|
{
|