|
|
@@ -1,4 +1,5 @@
|
|
|
using CacheManager.Core;
|
|
|
+using EFCoreSecondLevelCacheInterceptor;
|
|
|
using Masuit.LuceneEFCore.SearchEngine.Interfaces;
|
|
|
using Masuit.MyBlogs.Core.Common;
|
|
|
using Masuit.MyBlogs.Core.Infrastructure.Repository.Interface;
|
|
|
@@ -58,10 +59,12 @@ namespace Masuit.MyBlogs.Core.Infrastructure.Services
|
|
|
where = where.And(a => a.RegionMode == RegionLimitMode.All || (a.RegionMode == RegionLimitMode.AllowRegion ? Regex.IsMatch(location, a.Regions) : !Regex.IsMatch(location, a.Regions)));
|
|
|
if (cid.HasValue)
|
|
|
{
|
|
|
- var scid = cid.ToString();
|
|
|
- if (Any(a => a.CategoryIds.Contains(scid)))
|
|
|
+ var cids1 = CategoryRepository.GetQuery(c => c.ParentId == cid).Select(c => c.Id).Cacheable().ToArray();
|
|
|
+ var cids2 = CategoryRepository.GetQuery(c => c.Id == cid && c.ParentId != null).Select(c => c.ParentId.Value).Cacheable().ToArray();
|
|
|
+ var scid = cids1.Union(cids2).Append(cid.Value).Join("|");
|
|
|
+ if (Any(a => Regex.IsMatch(a.CategoryIds, scid)))
|
|
|
{
|
|
|
- where = where.And(a => a.CategoryIds.Contains(scid) || string.IsNullOrEmpty(a.CategoryIds));
|
|
|
+ where = where.And(a => Regex.IsMatch(a.CategoryIds, scid) || string.IsNullOrEmpty(a.CategoryIds));
|
|
|
}
|
|
|
}
|
|
|
|