管理端接口swagger注释

This commit is contained in:
linfeng 2022-11-16 10:40:39 +08:00
parent 6be54a5966
commit 57f93b6144
5 changed files with 63 additions and 72 deletions

View File

@ -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();

View File

@ -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;
@ -37,17 +35,18 @@ import io.linfeng.common.utils.R;
* @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<String, Object> 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();

View File

@ -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<String, Object> 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));

View File

@ -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.*;
@ -33,17 +35,17 @@ import io.linfeng.common.utils.R;
* @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<String, Object> 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();

View File

@ -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());