swagger文档

This commit is contained in:
linfeng 2022-11-16 10:29:38 +08:00
parent 1a7b99515d
commit 6be54a5966
3 changed files with 42 additions and 92 deletions

View File

@ -47,47 +47,6 @@ public class Constant {
public static final Integer USER_NORMAL = 0; public static final Integer USER_NORMAL = 0;
public static final Integer USER_BANNER = 1; public static final Integer USER_BANNER = 1;
/**
* 圈子是否禁用
*/
public static final Integer TOPIC_NORMAL = 0;
public static final Integer TOPIC_BANNER = 1;
/**
* 敏感词是否开启审核
*/
public static final Integer SENSITIVE_CLOSE = 0;
public static final Integer SENSITIVE_OPEN = 1;
/**
* 敏感词处理措施 1-禁止发布 2-需审核
*/
public static final Integer DEAL_BANNER = 1;
public static final Integer DEAL_EXAMINE = 2;
/**
* 1为点赞2为评论 3为收藏 4为关注 5为推送通知 6私聊
*/
public static final Integer STAR = 1;
public static final Integer COMMENT = 2;
public static final Integer COLLECT = 3;
public static final Integer WATCH = 4;
public static final Integer PUSHARTICLE = 5;
public static final Integer CHAT = 6;
public static final String TITLE_WATCH = "关注通知";
public static final String TITLE_COMMENT = "评论通知";
public static final String TITLE_STAR = "点赞通知";
public static final String TITLE_COLLECT = "点赞收藏通知";
public static final String TITLE_CHAT = "私聊通知";
public static final String TITLE_VIOLATION = "违规通知";
public static final String CONTENT_WATCH = "用户【{}】关注了你";
public static final String CONTENT_STAR = "用户【{}】点赞了你的评论:{}";
public static final String CONTENT_COMMENT = "用户【{}】评论了你的动态[{}]:{}";
public static final String CONTENT_COMMENT_REPLY = "用户【{}】回复了你在动态[{}]下的评论:{}";
public static final String CONTENT_POST_STAR = "用户【{}】点赞收藏了你的动态:{}";
public static final String ADMIN_POST_DOWN = "你的动态【{}】由于违反社区规定已被删除";
/** /**
* 手机验证码长度 * 手机验证码长度

View File

@ -13,13 +13,11 @@
import java.util.Arrays; import java.util.Arrays;
import java.util.Map; import java.util.Map;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.*;
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 io.linfeng.modules.admin.entity.AppUserEntity; import io.linfeng.modules.admin.entity.AppUserEntity;
import io.linfeng.modules.admin.service.AppUserService; import io.linfeng.modules.admin.service.AppUserService;
@ -30,22 +28,22 @@ import io.linfeng.common.utils.R;
/** /**
* *
* * 管理端会员管理
* @author linfeng * @author linfeng
* @email 2445465217@qq.com * @email 2445465217@qq.com
* @date 2022-01-20 12:10:43 * @date 2022-01-20 12:10:43
*/ */
@Api(tags = "管理端——会员管理")
@RestController @RestController
@RequestMapping("admin/user") @RequestMapping("admin/user")
public class AppUserController { public class AppUserController {
@Autowired @Autowired
private AppUserService appUserService; private AppUserService appUserService;
/**
* 列表 @GetMapping("/list")
*/
@RequestMapping("/list")
@RequiresPermissions("admin:user:list") @RequiresPermissions("admin:user:list")
@ApiOperation("用户列表")
public R list(@RequestParam Map<String, Object> params){ public R list(@RequestParam Map<String, Object> params){
PageUtils page = appUserService.queryPage(params); PageUtils page = appUserService.queryPage(params);
@ -53,65 +51,60 @@ public class AppUserController {
} }
/**
* 信息 @GetMapping("/info/{uid}")
*/
@RequestMapping("/info/{uid}")
@RequiresPermissions("admin:user:info") @RequiresPermissions("admin:user:info")
@ApiOperation("用户详情")
public R info(@PathVariable("uid") Integer uid){ public R info(@PathVariable("uid") Integer uid){
AppUserEntity user = appUserService.getById(uid); AppUserEntity user = appUserService.getById(uid);
return R.ok().put("user", user); return R.ok().put("user", user);
} }
/**
* 保存 @PostMapping("/save")
*/
@RequestMapping("/save")
@RequiresPermissions("admin:user:save") @RequiresPermissions("admin:user:save")
@ApiOperation("用户保存")
public R save(@RequestBody AppUserEntity user){ public R save(@RequestBody AppUserEntity user){
appUserService.save(user); appUserService.save(user);
return R.ok(); return R.ok();
} }
/**
* 修改 @PostMapping("/update")
*/
@RequestMapping("/update")
@RequiresPermissions("admin:user:update") @RequiresPermissions("admin:user:update")
@ApiOperation("用户修改")
public R update(@RequestBody AppUserEntity user){ public R update(@RequestBody AppUserEntity user){
appUserService.updateById(user); appUserService.updateById(user);
return R.ok(); return R.ok();
} }
/**
* 删除 @PostMapping("/delete")
*/
@RequestMapping("/delete")
@RequiresPermissions("admin:user:delete") @RequiresPermissions("admin:user:delete")
@ApiOperation("用户修改")
public R delete(@RequestBody Integer[] uids){ public R delete(@RequestBody Integer[] uids){
appUserService.removeByIds(Arrays.asList(uids)); appUserService.removeByIds(Arrays.asList(uids));
return R.ok(); return R.ok();
} }
/**
* 用户禁用 @PostMapping("/ban/{id}")
*/ @RequiresPermissions("admin:user:update")
@RequestMapping("/ban/{id}") @ApiOperation("用户禁用")
@RequiresPermissions("admin:user:delete")
public R ban(@PathVariable("id") Integer id){ public R ban(@PathVariable("id") Integer id){
appUserService.ban(id); appUserService.ban(id);
return R.ok(); return R.ok();
} }
/**
* 用户解除禁用
*/ @PostMapping("/openBan/{id}")
@RequestMapping("/openBan/{id}") @RequiresPermissions("admin:user:update")
@RequiresPermissions("admin:user:delete") @ApiOperation("用户解除禁用")
public R openBan(@PathVariable("id") Integer id){ public R openBan(@PathVariable("id") Integer id){
appUserService.openBan(id); appUserService.openBan(id);

View File

@ -14,6 +14,8 @@ package io.linfeng.modules.admin.controller;
import java.util.Arrays; import java.util.Arrays;
import java.util.Map; import java.util.Map;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -31,6 +33,7 @@ import io.linfeng.common.utils.R;
* @email 2445465217@qq.com * @email 2445465217@qq.com
* @date 2022-01-21 14:32:52 * @date 2022-01-21 14:32:52
*/ */
@Api(tags = "管理端——分类管理")
@RestController @RestController
@RequestMapping("admin/category") @RequestMapping("admin/category")
public class CategoryController { public class CategoryController {
@ -39,11 +42,10 @@ public class CategoryController {
@Autowired @Autowired
private CategoryService categoryService; private CategoryService categoryService;
/**
* 列表
*/
@GetMapping("/list") @GetMapping("/list")
@RequiresPermissions("admin:category:list") @RequiresPermissions("admin:category:list")
@ApiOperation("分类列表")
public R list(@RequestParam Map<String, Object> params){ public R list(@RequestParam Map<String, Object> params){
PageUtils page = categoryService.queryPage(params); PageUtils page = categoryService.queryPage(params);
@ -51,22 +53,20 @@ public class CategoryController {
} }
/**
* 信息
*/
@GetMapping("/info/{cateId}") @GetMapping("/info/{cateId}")
@RequiresPermissions("admin:category:info") @RequiresPermissions("admin:category:info")
@ApiOperation("分类详情")
public R info(@PathVariable("cateId") Integer cateId){ public R info(@PathVariable("cateId") Integer cateId){
CategoryEntity category = categoryService.getById(cateId); CategoryEntity category = categoryService.getById(cateId);
return R.ok().put("category", category); return R.ok().put("category", category);
} }
/**
* 保存
*/
@PostMapping("/save") @PostMapping("/save")
@RequiresPermissions("admin:category:save") @RequiresPermissions("admin:category:save")
@ApiOperation("分类保存")
public R save(@RequestBody CategoryEntity category){ public R save(@RequestBody CategoryEntity category){
categoryService.saveCategory(category); categoryService.saveCategory(category);
@ -74,22 +74,20 @@ public class CategoryController {
return R.ok(); return R.ok();
} }
/**
* 修改
*/
@PostMapping("/update") @PostMapping("/update")
@RequiresPermissions("admin:category:update") @RequiresPermissions("admin:category:update")
@ApiOperation("分类修改")
public R update(@RequestBody CategoryEntity category){ public R update(@RequestBody CategoryEntity category){
categoryService.updateById(category); categoryService.updateById(category);
return R.ok(); return R.ok();
} }
/**
* 删除
*/
@PostMapping("/delete") @PostMapping("/delete")
@RequiresPermissions("admin:category:delete") @RequiresPermissions("admin:category:delete")
@ApiOperation("分类删除")
public R delete(@RequestBody Integer[] cateIds){ public R delete(@RequestBody Integer[] cateIds){
categoryService.deleteByIdList(Arrays.asList(cateIds)); categoryService.deleteByIdList(Arrays.asList(cateIds));