From 10ad2e710d2bd52aac31d5d63a7bb6beae76b6a8 Mon Sep 17 00:00:00 2001 From: KKSU <15274802129@163.com> Date: Tue, 07 Nov 2023 14:35:32 +0800 Subject: [PATCH] 用户列表增加搜索条件 --- src/main/java/cc/mrbird/febs/mall/controller/AdminNewsInfoController.java | 35 +++++++++++++++++++++++++++++++++-- 1 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/main/java/cc/mrbird/febs/mall/controller/AdminNewsInfoController.java b/src/main/java/cc/mrbird/febs/mall/controller/AdminNewsInfoController.java index 49e56c3..456b314 100644 --- a/src/main/java/cc/mrbird/febs/mall/controller/AdminNewsInfoController.java +++ b/src/main/java/cc/mrbird/febs/mall/controller/AdminNewsInfoController.java @@ -16,6 +16,7 @@ import javax.management.Query; import javax.validation.Valid; import javax.validation.constraints.NotNull; +import java.util.List; import java.util.Map; /** @@ -72,9 +73,39 @@ @GetMapping("findNewsCategoryList") - @ControllerEndpoint(operation = "") + @ControllerEndpoint(operation = "新闻分类列表", exceptionMessage = "获取失败") public FebsResponse findNewsCategoryList(MallNewsCategory mallNewsCategory, QueryRequest request) { - return null; + return new FebsResponse().success().data(getDataTable(mallNewsInfoService.findNewsCategoryInPage(mallNewsCategory, request))); } + @PostMapping("addOrModifyNewsCategory") + @ControllerEndpoint(operation = "新闻分类", exceptionMessage = "新增失败") + public FebsResponse addOrModifyNewsCategory(MallNewsCategory mallNewsCategory) { + mallNewsInfoService.addOrModifyNewsCategory(mallNewsCategory); + return new FebsResponse().success().message("新增成功"); + } + + @GetMapping(value = "findAllCategoryList") + public FebsResponse findAllCategoryList() { + List<MallNewsCategory> categories = mallNewsInfoService.findAllCategory(); + return new FebsResponse().success().data(categories); + } + + @PostMapping(value = "/topNews/{id}") + public FebsResponse topNews(@PathVariable Long id) { + MallNewsInfo mallNewsInfo = new MallNewsInfo(); + mallNewsInfo.setIsTop(1); + mallNewsInfo.setId(id); + mallNewsInfoService.updateById(mallNewsInfo); + return new FebsResponse().success(); + } + + @PostMapping(value = "/unTopNews/{id}") + public FebsResponse unTopNews(@PathVariable Long id) { + MallNewsInfo mallNewsInfo = new MallNewsInfo(); + mallNewsInfo.setIsTop(2); + mallNewsInfo.setId(id); + mallNewsInfoService.updateById(mallNewsInfo); + return new FebsResponse().success(); + } } -- Gitblit v1.9.1