修复列表展示问题

This commit is contained in:
橙子
2022-10-16 16:09:45 +08:00
parent cf43dc8e70
commit 6d99539730
3 changed files with 3 additions and 3 deletions

View File

@@ -50,7 +50,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers
public override Task<Result> Add(ArticleEntity entity)
{
//如果标题为空默认为内容的前20个字符
entity.Title = entity.Title ?? entity.Content.Substring(0, 20);
entity.Title = string.IsNullOrEmpty(entity.Title) ? entity.Content.Substring(0, 20): entity.Title;
entity.UserId = HttpContext.GetUserIdInfo();
return base.Add(entity);
}

View File

@@ -19,7 +19,7 @@ namespace Yi.Framework.Service
//.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.Asc)
.OrderBy(u => u.CreateTime, OrderByType.Desc)
.ToPageListAsync(page.PageNum, page.PageSize, total);
return new PageModel<List<ArticleEntity>>(data, total);