From 57f93b6144f29604b7955d58d0b3615b8d73c36f Mon Sep 17 00:00:00 2001 From: linfeng <2445465217@qq.com> Date: Wed, 16 Nov 2022 10:40:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=AB=AF=E6=8E=A5=E5=8F=A3sw?= =?UTF-8?q?agger=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/linfeng/config/SwaggerConfig.java | 4 +- .../admin/controller/CommentController.java | 47 +++++++++---------- .../admin/controller/LinkController.java | 46 ++++++++---------- .../admin/controller/PostController.java | 34 +++++++------- .../admin/controller/StatisticController.java | 4 ++ 5 files changed, 63 insertions(+), 72 deletions(-) diff --git a/src/main/java/io/linfeng/config/SwaggerConfig.java b/src/main/java/io/linfeng/config/SwaggerConfig.java index ac6a99c..3fa574d 100644 --- a/src/main/java/io/linfeng/config/SwaggerConfig.java +++ b/src/main/java/io/linfeng/config/SwaggerConfig.java @@ -45,8 +45,8 @@ public class SwaggerConfig implements WebMvcConfigurer { private ApiInfo apiInfo(){ return new ApiInfoBuilder() - .title("林风社交论坛项目接口文档") - .description("林风社交论坛项目开源版接口文档 演示地址 https://www.linfeng.tech") + .title("林风社交论坛开源版接口文档") + .description("林风社交论坛项目开源版接口文档 官网 https://net.linfeng.tech") .contact(new Contact("linfeng","http:localhost:8080/doc.html","linfengtech001@163.com")) .version("1.0") .build(); diff --git a/src/main/java/io/linfeng/modules/admin/controller/CommentController.java b/src/main/java/io/linfeng/modules/admin/controller/CommentController.java index 18ae123..ec84279 100644 --- a/src/main/java/io/linfeng/modules/admin/controller/CommentController.java +++ b/src/main/java/io/linfeng/modules/admin/controller/CommentController.java @@ -15,13 +15,11 @@ package io.linfeng.modules.admin.controller; import java.util.Arrays; import java.util.Map; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import io.linfeng.modules.admin.entity.CommentEntity; import io.linfeng.modules.admin.service.CommentService; @@ -32,22 +30,23 @@ import io.linfeng.common.utils.R; /** * - *评论管理 + * 评论管理 * @author linfeng * @email 2445465217@qq.com * @date 2022-01-24 21:29:22 */ +@Api(tags = "管理端——评论管理") @RestController @RequestMapping("admin/comment") public class CommentController { @Autowired private CommentService commentService; - /** - * 列表 - */ - @RequestMapping("/list") + + + @GetMapping("/list") @RequiresPermissions("admin:comment:list") + @ApiOperation("评论列表") public R list(@RequestParam Map params){ PageUtils page = commentService.queryPage(params); @@ -55,44 +54,40 @@ public class CommentController { } - /** - * 信息 - */ - @RequestMapping("/info/{id}") + + @GetMapping("/info/{id}") @RequiresPermissions("admin:comment:info") + @ApiOperation("评论详情") public R info(@PathVariable("id") Long id){ CommentEntity comment = commentService.getById(id); return R.ok().put("comment", comment); } - /** - * 保存 - */ - @RequestMapping("/save") + + @PostMapping("/save") @RequiresPermissions("admin:comment:save") + @ApiOperation("评论保存") public R save(@RequestBody CommentEntity comment){ commentService.save(comment); return R.ok(); } - /** - * 修改 - */ - @RequestMapping("/update") + + @PostMapping("/update") @RequiresPermissions("admin:comment:update") + @ApiOperation("评论修改") public R update(@RequestBody CommentEntity comment){ commentService.updateById(comment); return R.ok(); } - /** - * 删除 - */ - @RequestMapping("/delete") + + @PostMapping("/delete") @RequiresPermissions("admin:comment:delete") + @ApiOperation("评论删除") public R delete(@RequestBody Long[] ids){ commentService.deleteByAdmin(Arrays.asList(ids)); return R.ok(); diff --git a/src/main/java/io/linfeng/modules/admin/controller/LinkController.java b/src/main/java/io/linfeng/modules/admin/controller/LinkController.java index da3328a..e188a0b 100644 --- a/src/main/java/io/linfeng/modules/admin/controller/LinkController.java +++ b/src/main/java/io/linfeng/modules/admin/controller/LinkController.java @@ -15,13 +15,11 @@ package io.linfeng.modules.admin.controller; import java.util.Arrays; import java.util.Map; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import io.linfeng.modules.admin.entity.LinkEntity; import io.linfeng.modules.admin.service.LinkService; @@ -31,23 +29,23 @@ import io.linfeng.common.utils.R; /** - * + * 管理端——轮播图管理 * * @author linfeng * @email 2445465217@qq.com * @date 2022-01-26 14:05:38 */ +@Api(tags = "管理端——轮播图管理") @RestController @RequestMapping("admin/link") public class LinkController { @Autowired private LinkService linkService; - /** - * 列表 - */ - @RequestMapping("/list") + + @GetMapping("/list") @RequiresPermissions("admin:link:list") + @ApiOperation("轮播图列表") public R list(@RequestParam Map params){ PageUtils page = linkService.queryPage(params); @@ -55,44 +53,40 @@ public class LinkController { } - /** - * 信息 - */ - @RequestMapping("/info/{id}") + + @GetMapping("/info/{id}") @RequiresPermissions("admin:link:info") + @ApiOperation("轮播图信息") public R info(@PathVariable("id") Integer id){ LinkEntity link = linkService.getById(id); return R.ok().put("link", link); } - /** - * 保存 - */ - @RequestMapping("/save") + + @PostMapping("/save") @RequiresPermissions("admin:link:save") + @ApiOperation("轮播图保存") public R save(@RequestBody LinkEntity link){ linkService.save(link); return R.ok(); } - /** - * 修改 - */ - @RequestMapping("/update") + + @PostMapping("/update") @RequiresPermissions("admin:link:update") + @ApiOperation("轮播图修改") public R update(@RequestBody LinkEntity link){ linkService.updateById(link); return R.ok(); } - /** - * 删除 - */ - @RequestMapping("/delete") + + @PostMapping("/delete") @RequiresPermissions("admin:link:delete") + @ApiOperation("轮播图删除") public R delete(@RequestBody Integer[] ids){ linkService.removeByIds(Arrays.asList(ids)); diff --git a/src/main/java/io/linfeng/modules/admin/controller/PostController.java b/src/main/java/io/linfeng/modules/admin/controller/PostController.java index 979b06a..3571d81 100644 --- a/src/main/java/io/linfeng/modules/admin/controller/PostController.java +++ b/src/main/java/io/linfeng/modules/admin/controller/PostController.java @@ -15,6 +15,8 @@ package io.linfeng.modules.admin.controller; import java.util.Arrays; import java.util.Map; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -28,22 +30,22 @@ import io.linfeng.common.utils.R; /** * - *帖子管理 + * 帖子管理 * @author linfeng * @email 2445465217@qq.com * @date 2022-01-23 20:49:55 */ +@Api(tags = "管理端——帖子管理") @RestController @RequestMapping("admin/post") public class PostController { @Autowired private PostService postService; - /** - * 列表 - */ - @RequestMapping("/list") + + @GetMapping("/list") @RequiresPermissions("admin:post:list") + @ApiOperation("帖子列表") public R list(@RequestParam Map params){ PageUtils page = postService.queryPage(params); @@ -51,44 +53,40 @@ public class PostController { } - /** - * 信息 - */ - @RequestMapping("/info/{id}") + + @GetMapping("/info/{id}") @RequiresPermissions("admin:post:info") + @ApiOperation("帖子信息") public R info(@PathVariable("id") Integer id){ PostEntity post = postService.getById(id); return R.ok().put("post", post); } - /** - * 保存 - */ + @PostMapping("/save") @RequiresPermissions("admin:post:save") + @ApiOperation("帖子保存") public R save(@RequestBody PostEntity post){ postService.save(post); return R.ok(); } - /** - * 修改 - */ + @PostMapping("/update") @RequiresPermissions("admin:post:update") + @ApiOperation("帖子修改") public R update(@RequestBody PostEntity post){ postService.updateById(post); return R.ok(); } - /** - * 删除 - */ + @PostMapping("/delete") @RequiresPermissions("admin:post:delete") + @ApiOperation("帖子删除") public R delete(@RequestBody Integer[] ids){ postService.deleteByAdmin(Arrays.asList(ids)); return R.ok(); diff --git a/src/main/java/io/linfeng/modules/admin/controller/StatisticController.java b/src/main/java/io/linfeng/modules/admin/controller/StatisticController.java index 54a0290..f86f499 100644 --- a/src/main/java/io/linfeng/modules/admin/controller/StatisticController.java +++ b/src/main/java/io/linfeng/modules/admin/controller/StatisticController.java @@ -14,6 +14,8 @@ package io.linfeng.modules.admin.controller; import io.linfeng.common.utils.R; import io.linfeng.modules.admin.service.AppUserService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -27,6 +29,7 @@ import org.springframework.web.bind.annotation.RestController; */ @RestController @RequestMapping("admin/statistics") +@Api(tags = "管理端——数据统计") public class StatisticController { @Autowired @@ -34,6 +37,7 @@ public class StatisticController { @GetMapping("/home") + @ApiOperation("后台前端首页数据统计") public R index() { return R.ok().put("result", userService.indexDate());