diff --git a/ZR.Admin.WebApi/Controllers/System/ArticleController.cs b/ZR.Admin.WebApi/Controllers/System/ArticleController.cs index c6f9ce9..9274ccf 100644 --- a/ZR.Admin.WebApi/Controllers/System/ArticleController.cs +++ b/ZR.Admin.WebApi/Controllers/System/ArticleController.cs @@ -54,6 +54,27 @@ namespace ZR.Admin.WebApi.Controllers return SUCCESS(response); } + /// + /// 查询最新文章列表 + /// + /// + [HttpGet("newList")] + public IActionResult QueryNew() + { + //开始拼装查询条件 + var predicate = Expressionable.Create
(); + + //搜索条件 + predicate = predicate.And(m => m.Status == "1"); + + var response = _ArticleService.Queryable() + .Where(predicate.ToExpression()) + .Take(10) + .OrderBy(f => f.UpdateTime, OrderByType.Desc).ToList(); + + return SUCCESS(response); + } + /// /// 获取文章目录,前端没用到 /// diff --git a/ZR.Vue/src/api/system/article.js b/ZR.Vue/src/api/system/article.js index a25523f..05fb94d 100644 --- a/ZR.Vue/src/api/system/article.js +++ b/ZR.Vue/src/api/system/article.js @@ -8,6 +8,14 @@ export function listArticle(query) { params: query }) } +// 查询最新列表 +export function listNewArticle(query) { + return request({ + url: '/Article/newList', + method: 'get', + params: query + }) +} // 查询详细 export function getArticle(Id) {