using FruitBank.Common.Entities; using LinqToDB; using Mango.Nop.Data.Repositories; using Nop.Core.Caching; using Nop.Core.Configuration; using Nop.Core.Events; using Nop.Data; using Mango.Nop.Core.Loggers; namespace Nop.Plugin.Misc.FruitBankPlugin.Domains.DataLayer; public class ProductTextMappingDbTable : MgDbTableBase { public ProductTextMappingDbTable(IEventPublisher eventPublisher, INopDataProvider dataProvider, IShortTermCacheManager shortTermCacheManager, IStaticCacheManager staticCacheManager, AppSettings appSettings) : base(eventPublisher, dataProvider, shortTermCacheManager, staticCacheManager, appSettings) { } public IQueryable GetByRawText(string rawText) => GetAll().Where(m => m.RawText == rawText.ToLower().Trim()); public IQueryable GetByRawText(string rawText, bool isPreorder) => GetByRawText(rawText).Where(m => m.IsPreorder == isPreorder); public IQueryable GetRecentByRawText(string rawText, bool isPreorder, int lastCount = 5) => GetByRawText(rawText, isPreorder).OrderByDescending(m => m.CreatedOnUtc).Take(lastCount); }