|
@@ -649,11 +649,6 @@ namespace Hotline.Api.Controllers
|
|
|
.Where(x => x.IsDeleted == false)
|
|
|
.Where(x => x.Status == EKnowledgeStatus.OnShelf)
|
|
|
.Where(x => x.KnowledgeType.Any(t => t.KnowledgeType.KnowledgeTypeOrgs.Any(to => to.OrgId == _sessionContext.RequiredOrgId) || t.KnowledgeType.KnowledgeTypeOrgs.Any() == false))
|
|
|
- // .WhereIF(dto.RetrievalType == EKnowledgeRetrievalType.All && !string.IsNullOrEmpty(dto.Keyword), d => d.Title.Contains(dto.Keyword!) || d.Content.Contains(dto.Keyword!))
|
|
|
- //.WhereIF(dto.RetrievalType == EKnowledgeRetrievalType.Title && !string.IsNullOrEmpty(dto.Keyword), d => d.Title.Contains(dto.Keyword!))
|
|
|
- //.WhereIF(dto.RetrievalType == EKnowledgeRetrievalType.Content && !string.IsNullOrEmpty(dto.Keyword), d => d.Content.Contains(dto.Keyword!))
|
|
|
- //.WhereIF(dto.RetrievalType == EKnowledgeRetrievalType.Summary && !string.IsNullOrEmpty(dto.Keyword), d => d.Summary != null && d.Summary.Contains(dto.Keyword!))
|
|
|
- //.WhereIF(!string.IsNullOrEmpty(typeSpliceName), x => SqlFunc.JsonLike(x.KnowledgeType, typeSpliceName))
|
|
|
.WhereIF(!string.IsNullOrEmpty(typeSpliceName), x => x.KnowledgeType.Any(t => t.KnowledgeTypeSpliceName.EndsWith(typeSpliceName)))
|
|
|
.WhereIF(!string.IsNullOrEmpty(hotspotHotSpotFullName), x => x.HotspotType.HotSpotFullName.EndsWith(hotspotHotSpotFullName!))
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.HotspotName), x => x.HotspotType.HotSpotFullName.EndsWith(dto.HotspotName!))
|
|
@@ -666,22 +661,31 @@ namespace Hotline.Api.Controllers
|
|
|
foreach (var keyword in keywords)
|
|
|
{
|
|
|
if (dto.RetrievalType == EKnowledgeRetrievalType.All)
|
|
|
- exp.Or(m => m.Title.Contains(keyword) || m.Content.Contains(keyword));
|
|
|
+ exp.Or(x => x.Title.Contains(keyword) || x.Content.Contains(keyword));
|
|
|
if (dto.RetrievalType == EKnowledgeRetrievalType.Title)
|
|
|
- exp.Or(m => m.Title.Contains(keyword));
|
|
|
+ exp.Or(x => x.Title.Contains(keyword));
|
|
|
if (dto.RetrievalType == EKnowledgeRetrievalType.Content)
|
|
|
- exp.Or(m => m.Content.Contains(keyword));
|
|
|
+ exp.Or(x => x.Content.Contains(keyword));
|
|
|
if (dto.RetrievalType == EKnowledgeRetrievalType.Summary)
|
|
|
- exp.Or(m => m.Summary != null && m.Summary.Contains(keyword));
|
|
|
+ exp.Or(x => x.Summary != null && x.Summary.Contains(keyword));
|
|
|
if (dto.RetrievalType == EKnowledgeRetrievalType.KeyWord)
|
|
|
{
|
|
|
var keywordEntity = await _knowledgeWordRepository.GetAsync(m => m.Tag == keyword && m.IsEnable == 0);
|
|
|
if (keywordEntity is null) continue;
|
|
|
- exp.Or(m => SqlFunc.JsonArrayAny(m.Keywords, keywordEntity.Id));
|
|
|
+ exp.Or(x => SqlFunc.JsonArrayAny(x.Keywords, keywordEntity.Id));
|
|
|
}
|
|
|
}
|
|
|
sugar.Where(exp.ToExpression());
|
|
|
}
|
|
|
+ if (dto.Content.NotNullOrEmpty())
|
|
|
+ {
|
|
|
+ var keywords = dto.Content!.GetSegment();
|
|
|
+ var keywordIds = _knowledgeWordRepository.Queryable()
|
|
|
+ .Where(m => keywords.Contains(m.Tag))
|
|
|
+ .Select(m => m.Id)
|
|
|
+ .ToList();
|
|
|
+ sugar = sugar.Where(x => SqlFunc.JsonArrayAny(x.Keywords, keywordIds));
|
|
|
+ }
|
|
|
|
|
|
switch (dto.Sort)
|
|
|
{
|
|
@@ -707,7 +711,7 @@ namespace Hotline.Api.Controllers
|
|
|
public async Task<Dictionary<string, dynamic>> GetKnowretrievalBaseData()
|
|
|
{
|
|
|
return _baseDataApplication
|
|
|
- .KnowledgeRetrievalType(new[] { 3, 4})
|
|
|
+ .KnowledgeRetrievalType([3, 4])
|
|
|
.Build();
|
|
|
}
|
|
|
|