using SqlSugar; using System.Collections.Generic; using System.Threading.Tasks; using Yi.Framework.Common.Models; using Yi.Framework.Interface; using Yi.Framework.Model.Models; using Yi.Framework.Repository; namespace Yi.Framework.Service { public partial class ArticleService : BaseService, IArticleService { public async Task>> SelctPageList(ArticleEntity entity, PageParModel page) { RefAsync total = 0; var data = await _repository._DbQueryable .Includes(x => x.User) //.WhereIF(!string.IsNullOrEmpty(config.ConfigName), u => u.ConfigName.Contains(config.ConfigName)) //.WhereIF(!string.IsNullOrEmpty(config.ConfigKey), u => u.ConfigKey.Contains(config.ConfigKey)) .WhereIF(page.StartTime is not null && page.EndTime is not null, u => u.CreateTime >= page.StartTime && u.CreateTime <= page.EndTime) .WhereIF(entity.IsDeleted is not null, u => u.IsDeleted == entity.IsDeleted) .OrderBy(u => u.CreateTime, OrderByType.Desc) .ToPageListAsync(page.PageNum, page.PageSize, total); return new PageModel>(data, total); } } }