浏览代码

update 补全演示案例 接口文档

疯狂的狮子li 3 年之前
父节点
当前提交
fd8affdc8a

+ 7 - 0
ruoyi-demo/src/main/java/com/ruoyi/demo/controller/FeignTestController.java

@@ -2,6 +2,8 @@ package com.ruoyi.demo.controller;
 
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.demo.feign.FeignTestService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -14,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
  *
  * @author Lion Li
  */
+@Api(value = "feign测试", tags = {"feign测试"})
 @RequiredArgsConstructor(onConstructor_ = @Autowired)
 @RestController
 @RequestMapping("/feign/test")
@@ -21,6 +24,10 @@ public class FeignTestController {
 
     private final FeignTestService feignTestService;
 
+    /**
+     * 搜索数据
+     */
+    @ApiOperation("测试使用feign请求数据")
     @GetMapping("/search/{wd}")
     public AjaxResult search(@PathVariable String wd) {
         String search = feignTestService.search(wd);

+ 6 - 0
ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisCacheController.java

@@ -1,6 +1,8 @@
 package com.ruoyi.demo.controller;
 
 import com.ruoyi.common.core.domain.AjaxResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cache.annotation.CacheEvict;
@@ -17,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
  */
 // 类级别 缓存统一配置
 //@CacheConfig(cacheNames = "redissonCacheMap")
+@Api(value = "spring-cache 演示案例", tags = {"spring-cache 演示案例"})
 @RequiredArgsConstructor(onConstructor_ = @Autowired)
 @RestController
 @RequestMapping("/demo/cache")
@@ -33,6 +36,7 @@ public class RedisCacheController {
 	 *
 	 * cacheNames 为配置文件内 groupId
 	 */
+	@ApiOperation("测试 @Cacheable")
 	@Cacheable(cacheNames = "redissonCacheMap", key = "#key", condition = "#key != null")
 	@GetMapping("/test1")
 	public AjaxResult<String> test1(String key, String value){
@@ -47,6 +51,7 @@ public class RedisCacheController {
 	 *
 	 * cacheNames 为 配置文件内 groupId
 	 */
+	@ApiOperation("测试 @CachePut")
 	@CachePut(cacheNames = "redissonCacheMap", key = "#key", condition = "#key != null")
 	@GetMapping("/test2")
 	public AjaxResult<String> test2(String key, String value){
@@ -61,6 +66,7 @@ public class RedisCacheController {
 	 *
 	 * cacheNames 为 配置文件内 groupId
 	 */
+	@ApiOperation("测试 @CacheEvict")
 	@CacheEvict(cacheNames = "redissonCacheMap", key = "#key", condition = "#key != null")
 	@GetMapping("/test3")
 	public AjaxResult<String> test3(String key, String value){

+ 6 - 0
ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisLockController.java

@@ -5,6 +5,8 @@ import com.baomidou.lock.LockTemplate;
 import com.baomidou.lock.annotation.Lock4j;
 import com.baomidou.lock.executor.RedissonLockExecutor;
 import com.ruoyi.common.core.domain.AjaxResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cache.annotation.Cacheable;
@@ -20,6 +22,7 @@ import java.time.LocalTime;
  *
  * @author shenxinquan
  */
+@Api(value = "测试分布式锁的样例", tags = {"测试分布式锁的样例"})
 @Slf4j
 @RestController
 @RequestMapping("/demo/redisLock")
@@ -31,6 +34,7 @@ public class RedisLockController {
 	/**
 	 * 测试lock4j 注解
 	 */
+	@ApiOperation("测试lock4j 注解")
 	@Lock4j(keys = {"#key"})
 	@GetMapping("/testLock4j")
 	public  AjaxResult<String> testLock4j(String key,String value){
@@ -47,6 +51,7 @@ public class RedisLockController {
 	/**
 	 * 测试lock4j 工具
 	 */
+	@ApiOperation("测试lock4j 工具")
 	@GetMapping("/testLock4jLockTemaplate")
 	public  AjaxResult<String> testLock4jLockTemaplate(String key,String value){
 		final LockInfo lockInfo = lockTemplate.lock(key, 30000L, 5000L, RedissonLockExecutor.class);
@@ -72,6 +77,7 @@ public class RedisLockController {
 	/**
 	 * 测试spring-cache注解
 	 */
+	@ApiOperation("测试spring-cache注解")
 	@Cacheable(value = "test", key = "#key")
 	@GetMapping("/testCache")
 	public AjaxResult<String> testCache(String key) {

+ 4 - 0
ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestI18nController.java

@@ -2,6 +2,8 @@ package com.ruoyi.demo.controller;
 
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.utils.MessageUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -12,6 +14,7 @@ import org.springframework.web.bind.annotation.RestController;
  *
  * @author Lion Li
  */
+@Api(value = "测试国际化控制器", tags = {"测试国际化管理"})
 @RestController
 @RequestMapping("/demo/i18n")
 public class TestI18nController {
@@ -22,6 +25,7 @@ public class TestI18nController {
 	 *
 	 * 测试使用 user.register.success
 	 */
+	@ApiOperation("通过code获取国际化内容")
 	@GetMapping()
 	public AjaxResult<Void> get(String code) {
 		return AjaxResult.success(MessageUtils.message(code));