From f8487f581be226c3def30676055e0e32a5ac341a Mon Sep 17 00:00:00 2001
From: 疯狂的狮子li <15040126243@163.com>
Date: 星期四, 18 十一月 2021 17:01:23 +0800
Subject: [PATCH] update 补全所有接口 单参数接口文档
---
ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestI18nController.java | 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java | 7
ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisCacheController.java | 134 ++++++------
ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java | 15
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java | 7
ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisLockController.java | 104 +++++-----
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssConfigController.java | 7
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java | 7
ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java | 37 ++-
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java | 15 +
ruoyi-demo/src/main/java/com/ruoyi/demo/controller/Swagger3DemoController.java | 26 +-
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java | 5
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java | 9
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java | 5
ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisRateLimiterController.java | 60 +++---
ruoyi-generator/src/main/resources/vm/java/controller.java.vm | 7
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java | 6
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssController.java | 14
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java | 15
ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestBatchController.java | 54 ++--
ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisPubSubController.java | 33 +-
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java | 5
22 files changed, 303 insertions(+), 272 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java
index c8f9f45..e2b397d 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java
@@ -11,6 +11,7 @@
import com.ruoyi.system.service.ISysConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -59,7 +60,7 @@
@ApiOperation("鏍规嵁鍙傛暟缂栧彿鑾峰彇璇︾粏淇℃伅")
@PreAuthorize("@ss.hasPermi('system:config:query')")
@GetMapping(value = "/{configId}")
- public AjaxResult<SysConfig> getInfo(@PathVariable Long configId) {
+ public AjaxResult<SysConfig> getInfo(@ApiParam("鍙傛暟ID") @PathVariable Long configId) {
return AjaxResult.success(configService.selectConfigById(configId));
}
@@ -68,7 +69,7 @@
*/
@ApiOperation("鏍规嵁鍙傛暟閿悕鏌ヨ鍙傛暟鍊�")
@GetMapping(value = "/configKey/{configKey}")
- public AjaxResult<Void> getConfigKey(@PathVariable String configKey) {
+ public AjaxResult<Void> getConfigKey(@ApiParam("鍙傛暟Key") @PathVariable String configKey) {
return AjaxResult.success(configService.selectConfigByKey(configKey));
}
@@ -107,7 +108,7 @@
@PreAuthorize("@ss.hasPermi('system:config:remove')")
@Log(title = "鍙傛暟绠$悊", businessType = BusinessType.DELETE)
@DeleteMapping("/{configIds}")
- public AjaxResult<Void> remove(@PathVariable Long[] configIds) {
+ public AjaxResult<Void> remove(@ApiParam("鍙傛暟ID涓�") @PathVariable Long[] configIds) {
configService.deleteConfigByIds(configIds);
return success();
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java
index 8a46706..e47b1e8 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java
@@ -12,6 +12,7 @@
import com.ruoyi.system.service.ISysDeptService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -53,7 +54,7 @@
@ApiOperation("鏌ヨ閮ㄩ棬鍒楄〃锛堟帓闄よ妭鐐癸級")
@PreAuthorize("@ss.hasPermi('system:dept:list')")
@GetMapping("/list/exclude/{deptId}")
- public AjaxResult<List<SysDept>> excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) {
+ public AjaxResult<List<SysDept>> excludeChild(@ApiParam("閮ㄩ棬ID") @PathVariable(value = "deptId", required = false) Long deptId) {
List<SysDept> depts = deptService.selectDeptList(new SysDept());
depts.removeIf(d -> d.getDeptId().equals(deptId)
|| ArrayUtil.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""));
@@ -66,7 +67,7 @@
@ApiOperation("鏍规嵁閮ㄩ棬缂栧彿鑾峰彇璇︾粏淇℃伅")
@PreAuthorize("@ss.hasPermi('system:dept:query')")
@GetMapping(value = "/{deptId}")
- public AjaxResult<SysDept> getInfo(@PathVariable Long deptId) {
+ public AjaxResult<SysDept> getInfo(@ApiParam("閮ㄩ棬ID") @PathVariable Long deptId) {
deptService.checkDeptDataScope(deptId);
return AjaxResult.success(deptService.selectDeptById(deptId));
}
@@ -86,7 +87,7 @@
*/
@ApiOperation("鍔犺浇瀵瑰簲瑙掕壊閮ㄩ棬鍒楄〃鏍�")
@GetMapping(value = "/roleDeptTreeselect/{roleId}")
- public AjaxResult<Map<String, Object>> roleDeptTreeselect(@PathVariable("roleId") Long roleId) {
+ public AjaxResult<Map<String, Object>> roleDeptTreeselect(@ApiParam("瑙掕壊ID") @PathVariable("roleId") Long roleId) {
List<SysDept> depts = deptService.selectDeptList(new SysDept());
Map<String, Object> ajax = new HashMap<>();
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
@@ -134,7 +135,7 @@
@PreAuthorize("@ss.hasPermi('system:dept:remove')")
@Log(title = "閮ㄩ棬绠$悊", businessType = BusinessType.DELETE)
@DeleteMapping("/{deptId}")
- public AjaxResult<Void> remove(@PathVariable Long deptId) {
+ public AjaxResult<Void> remove(@ApiParam("閮ㄩ棬ID涓�") @PathVariable Long deptId) {
if (deptService.hasChildByDeptId(deptId)) {
return AjaxResult.error("瀛樺湪涓嬬骇閮ㄩ棬,涓嶅厑璁稿垹闄�");
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java
index 82b05cf..0a54db3 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java
@@ -12,6 +12,7 @@
import com.ruoyi.system.service.ISysDictTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -59,7 +60,7 @@
@ApiOperation("鏌ヨ瀛楀吀鏁版嵁璇︾粏")
@PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/{dictCode}")
- public AjaxResult<SysDictData> getInfo(@PathVariable Long dictCode) {
+ public AjaxResult<SysDictData> getInfo(@ApiParam("瀛楀吀code") @PathVariable Long dictCode) {
return AjaxResult.success(dictDataService.selectDictDataById(dictCode));
}
@@ -68,7 +69,7 @@
*/
@ApiOperation("鏍规嵁瀛楀吀绫诲瀷鏌ヨ瀛楀吀鏁版嵁淇℃伅")
@GetMapping(value = "/type/{dictType}")
- public AjaxResult<List<SysDictData>> dictType(@PathVariable String dictType) {
+ public AjaxResult<List<SysDictData>> dictType(@ApiParam("瀛楀吀绫诲瀷") @PathVariable String dictType) {
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
if (StringUtils.isNull(data)) {
data = new ArrayList<>();
@@ -105,7 +106,7 @@
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictCodes}")
- public AjaxResult<Void> remove(@PathVariable Long[] dictCodes) {
+ public AjaxResult<Void> remove(@ApiParam("瀛楀吀code涓�") @PathVariable Long[] dictCodes) {
dictDataService.deleteDictDataByIds(dictCodes);
return success();
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java
index eb3ae00..37e9d8c 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java
@@ -11,6 +11,7 @@
import com.ruoyi.system.service.ISysDictTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -56,7 +57,7 @@
@ApiOperation("鏌ヨ瀛楀吀绫诲瀷璇︾粏")
@PreAuthorize("@ss.hasPermi('system:dict:query')")
@GetMapping(value = "/{dictId}")
- public AjaxResult<SysDictType> getInfo(@PathVariable Long dictId) {
+ public AjaxResult<SysDictType> getInfo(@ApiParam("瀛楀吀ID") @PathVariable Long dictId) {
return AjaxResult.success(dictTypeService.selectDictTypeById(dictId));
}
@@ -95,7 +96,7 @@
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
@Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictIds}")
- public AjaxResult<Void> remove(@PathVariable Long[] dictIds) {
+ public AjaxResult<Void> remove(@ApiParam("瀛楀吀ID涓�") @PathVariable Long[] dictIds) {
dictTypeService.deleteDictTypeByIds(dictIds);
return success();
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java
index 11371f8..a525ac4 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java
@@ -11,6 +11,7 @@
import com.ruoyi.system.service.ISysMenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -52,7 +53,7 @@
@ApiOperation("鏍规嵁鑿滃崟缂栧彿鑾峰彇璇︾粏淇℃伅")
@PreAuthorize("@ss.hasPermi('system:menu:query')")
@GetMapping(value = "/{menuId}")
- public AjaxResult<SysMenu> getInfo(@PathVariable Long menuId) {
+ public AjaxResult<SysMenu> getInfo(@ApiParam("鑿滃崟ID") @PathVariable Long menuId) {
return AjaxResult.success(menuService.selectMenuById(menuId));
}
@@ -71,7 +72,7 @@
*/
@ApiOperation("鍔犺浇瀵瑰簲瑙掕壊鑿滃崟鍒楄〃鏍�")
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
- public AjaxResult<Map<String, Object>> roleMenuTreeselect(@PathVariable("roleId") Long roleId) {
+ public AjaxResult<Map<String, Object>> roleMenuTreeselect(@ApiParam("瑙掕壊ID") @PathVariable("roleId") Long roleId) {
List<SysMenu> menus = menuService.selectMenuList(getUserId());
Map<String, Object> ajax = new HashMap<>();
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
@@ -120,7 +121,7 @@
@PreAuthorize("@ss.hasPermi('system:menu:remove')")
@Log(title = "鑿滃崟绠$悊", businessType = BusinessType.DELETE)
@DeleteMapping("/{menuId}")
- public AjaxResult<Void> remove(@PathVariable("menuId") Long menuId) {
+ public AjaxResult<Void> remove(@ApiParam("鑿滃崟ID") @PathVariable("menuId") Long menuId) {
if (menuService.hasChildByMenuId(menuId)) {
return AjaxResult.error("瀛樺湪瀛愯彍鍗�,涓嶅厑璁稿垹闄�");
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java
index 6841bef..bafb720 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysNoticeController.java
@@ -9,6 +9,7 @@
import com.ruoyi.system.service.ISysNoticeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -45,7 +46,7 @@
@ApiOperation("鏍规嵁閫氱煡鍏憡缂栧彿鑾峰彇璇︾粏淇℃伅")
@PreAuthorize("@ss.hasPermi('system:notice:query')")
@GetMapping(value = "/{noticeId}")
- public AjaxResult<SysNotice> getInfo(@PathVariable Long noticeId) {
+ public AjaxResult<SysNotice> getInfo(@ApiParam("鍏憡ID") @PathVariable Long noticeId) {
return AjaxResult.success(noticeService.selectNoticeById(noticeId));
}
@@ -78,7 +79,7 @@
@PreAuthorize("@ss.hasPermi('system:notice:remove')")
@Log(title = "閫氱煡鍏憡", businessType = BusinessType.DELETE)
@DeleteMapping("/{noticeIds}")
- public AjaxResult<Void> remove(@PathVariable Long[] noticeIds) {
+ public AjaxResult<Void> remove(@ApiParam("鍏憡ID涓�") @PathVariable Long[] noticeIds) {
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
}
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssConfigController.java
index 1756ce7..db6ce7e 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssConfigController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssConfigController.java
@@ -14,6 +14,7 @@
import com.ruoyi.system.service.ISysOssConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -56,7 +57,8 @@
@ApiOperation("鑾峰彇瀵硅薄瀛樺偍閰嶇疆璇︾粏淇℃伅")
@PreAuthorize("@ss.hasPermi('system:oss:query')")
@GetMapping("/{ossConfigId}")
- public AjaxResult<SysOssConfigVo> getInfo(@NotNull(message = "涓婚敭涓嶈兘涓虹┖")
+ public AjaxResult<SysOssConfigVo> getInfo(@ApiParam("OSS閰嶇疆ID")
+ @NotNull(message = "涓婚敭涓嶈兘涓虹┖")
@PathVariable("ossConfigId") Integer ossConfigId) {
return AjaxResult.success(iSysOssConfigService.queryById(ossConfigId));
}
@@ -92,7 +94,8 @@
@PreAuthorize("@ss.hasPermi('system:oss:remove')")
@Log(title = "瀵硅薄瀛樺偍閰嶇疆", businessType = BusinessType.DELETE)
@DeleteMapping("/{ossConfigIds}")
- public AjaxResult<Void> remove(@NotEmpty(message = "涓婚敭涓嶈兘涓虹┖")
+ public AjaxResult<Void> remove(@ApiParam("OSS閰嶇疆ID涓�")
+ @NotEmpty(message = "涓婚敭涓嶈兘涓虹┖")
@PathVariable Long[] ossConfigIds) {
return toAjax(iSysOssConfigService.deleteWithValidByIds(Arrays.asList(ossConfigIds), true) ? 1 : 0);
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssController.java
index 62f3c44..bf5ae8b 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysOssController.java
@@ -23,10 +23,7 @@
import com.ruoyi.system.domain.vo.SysOssVo;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysOssService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.*;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
@@ -72,7 +69,7 @@
*/
@ApiOperation("涓婁紶OSS瀵硅薄瀛樺偍")
@ApiImplicitParams({
- @ApiImplicitParam(name = "file", value = "鏂囦欢", dataType = "java.io.File", required = true),
+ @ApiImplicitParam(name = "file", value = "鏂囦欢", dataType = "java.io.File", required = true),
})
@PreAuthorize("@ss.hasPermi('system:oss:upload')")
@Log(title = "OSS瀵硅薄瀛樺偍", businessType = BusinessType.INSERT)
@@ -92,7 +89,7 @@
@ApiOperation("涓嬭浇OSS瀵硅薄瀛樺偍")
@PreAuthorize("@ss.hasPermi('system:oss:download')")
@GetMapping("/download/{ossId}")
- public void download(@PathVariable Long ossId, HttpServletResponse response) throws IOException {
+ public void download(@ApiParam("OSS瀵硅薄ID") @PathVariable Long ossId, HttpServletResponse response) throws IOException {
SysOss sysOss = iSysOssService.getById(ossId);
if (ObjectUtil.isNull(sysOss)) {
throw new ServiceException("鏂囦欢鏁版嵁涓嶅瓨鍦�!");
@@ -120,7 +117,8 @@
@PreAuthorize("@ss.hasPermi('system:oss:remove')")
@Log(title = "OSS瀵硅薄瀛樺偍", businessType = BusinessType.DELETE)
@DeleteMapping("/{ossIds}")
- public AjaxResult<Void> remove(@NotEmpty(message = "涓婚敭涓嶈兘涓虹┖")
+ public AjaxResult<Void> remove(@ApiParam("OSS瀵硅薄ID涓�")
+ @NotEmpty(message = "涓婚敭涓嶈兘涓虹┖")
@PathVariable Long[] ossIds) {
return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true) ? 1 : 0);
}
@@ -135,7 +133,7 @@
public AjaxResult<Void> changePreviewListResource(@RequestBody String body) {
Map<String, Boolean> map = JsonUtils.parseMap(body);
SysConfig config = iSysConfigService.getOne(new LambdaQueryWrapper<SysConfig>()
- .eq(SysConfig::getConfigKey, CloudConstant.PEREVIEW_LIST_RESOURCE_KEY));
+ .eq(SysConfig::getConfigKey, CloudConstant.PEREVIEW_LIST_RESOURCE_KEY));
config.setConfigValue(map.get("previewListResource").toString());
return toAjax(iSysConfigService.updateConfig(config));
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java
index 0ccb313..d115619 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java
@@ -11,6 +11,7 @@
import com.ruoyi.system.service.ISysPostService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -59,7 +60,7 @@
@ApiOperation("鏍规嵁宀椾綅缂栧彿鑾峰彇璇︾粏淇℃伅")
@PreAuthorize("@ss.hasPermi('system:post:query')")
@GetMapping(value = "/{postId}")
- public AjaxResult<SysPost> getInfo(@PathVariable Long postId) {
+ public AjaxResult<SysPost> getInfo(@ApiParam("宀椾綅ID") @PathVariable Long postId) {
return AjaxResult.success(postService.selectPostById(postId));
}
@@ -102,7 +103,7 @@
@PreAuthorize("@ss.hasPermi('system:post:remove')")
@Log(title = "宀椾綅绠$悊", businessType = BusinessType.DELETE)
@DeleteMapping("/{postIds}")
- public AjaxResult<Void> remove(@PathVariable Long[] postIds) {
+ public AjaxResult<Void> remove(@ApiParam("宀椾綅ID涓�") @PathVariable Long[] postIds) {
return toAjax(postService.deletePostByIds(postIds));
}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java
index d037e79..b4534ad 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java
@@ -89,6 +89,10 @@
* 閲嶇疆瀵嗙爜
*/
@ApiOperation("閲嶇疆瀵嗙爜")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "oldPassword", value = "鏃у瘑鐮�", paramType = "query"),
+ @ApiImplicitParam(name = "newPassword", value = "鏂板瘑鐮�", paramType = "query")
+ })
@Log(title = "涓汉淇℃伅", businessType = BusinessType.UPDATE)
@PutMapping("/updatePwd")
public AjaxResult<Void> updatePwd(String oldPassword, String newPassword) {
@@ -115,7 +119,7 @@
*/
@ApiOperation("澶村儚涓婁紶")
@ApiImplicitParams({
- @ApiImplicitParam(name = "file", value = "鐢ㄦ埛澶村儚", dataType = "java.io.File", required = true),
+ @ApiImplicitParam(name = "avatarfile", value = "鐢ㄦ埛澶村儚", dataType = "java.io.File", required = true),
})
@Log(title = "鐢ㄦ埛澶村儚", businessType = BusinessType.UPDATE)
@PostMapping("/avatar")
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
index c1b9baa..2dd3104 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRoleController.java
@@ -16,8 +16,7 @@
import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.system.service.SysPermissionService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.*;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -66,7 +65,7 @@
@ApiOperation("鏍规嵁瑙掕壊缂栧彿鑾峰彇璇︾粏淇℃伅")
@PreAuthorize("@ss.hasPermi('system:role:query')")
@GetMapping(value = "/{roleId}")
- public AjaxResult<SysRole> getInfo(@PathVariable Long roleId) {
+ public AjaxResult<SysRole> getInfo(@ApiParam("瑙掕壊ID") @PathVariable Long roleId) {
roleService.checkRoleDataScope(roleId);
return AjaxResult.success(roleService.selectRoleById(roleId));
}
@@ -147,7 +146,7 @@
@PreAuthorize("@ss.hasPermi('system:role:remove')")
@Log(title = "瑙掕壊绠$悊", businessType = BusinessType.DELETE)
@DeleteMapping("/{roleIds}")
- public AjaxResult<Void> remove(@PathVariable Long[] roleIds) {
+ public AjaxResult<Void> remove(@ApiParam("宀椾綅ID涓�") @PathVariable Long[] roleIds) {
return toAjax(roleService.deleteRoleByIds(roleIds));
}
@@ -196,6 +195,10 @@
* 鎵归噺鍙栨秷鎺堟潈鐢ㄦ埛
*/
@ApiOperation("鎵归噺鍙栨秷鎺堟潈鐢ㄦ埛")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "roleId", value = "瑙掕壊ID", paramType = "query"),
+ @ApiImplicitParam(name = "userIds", value = "鐢ㄦ埛ID涓�", paramType = "query")
+ })
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "瑙掕壊绠$悊", businessType = BusinessType.GRANT)
@PutMapping("/authUser/cancelAll")
@@ -207,6 +210,10 @@
* 鎵归噺閫夋嫨鐢ㄦ埛鎺堟潈
*/
@ApiOperation("鎵归噺閫夋嫨鐢ㄦ埛鎺堟潈")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "roleId", value = "瑙掕壊ID", paramType = "query"),
+ @ApiImplicitParam(name = "userIds", value = "鐢ㄦ埛ID涓�", paramType = "query")
+ })
@PreAuthorize("@ss.hasPermi('system:role:edit')")
@Log(title = "瑙掕壊绠$悊", businessType = BusinessType.GRANT)
@PutMapping("/authUser/selectAll")
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
index b869221..a57fb15 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
@@ -20,10 +20,7 @@
import com.ruoyi.system.service.ISysPostService;
import com.ruoyi.system.service.ISysRoleService;
import com.ruoyi.system.service.ISysUserService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.*;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -109,7 +106,7 @@
@ApiOperation("鏍规嵁鐢ㄦ埛缂栧彿鑾峰彇璇︾粏淇℃伅")
@PreAuthorize("@ss.hasPermi('system:user:query')")
@GetMapping(value = {"/", "/{userId}"})
- public AjaxResult<Map<String, Object>> getInfo(@PathVariable(value = "userId", required = false) Long userId) {
+ public AjaxResult<Map<String, Object>> getInfo(@ApiParam("鐢ㄦ埛ID") @PathVariable(value = "userId", required = false) Long userId) {
userService.checkUserDataScope(userId);
Map<String, Object> ajax = new HashMap<>();
List<SysRole> roles = roleService.selectRoleAll();
@@ -170,7 +167,7 @@
@PreAuthorize("@ss.hasPermi('system:user:remove')")
@Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.DELETE)
@DeleteMapping("/{userIds}")
- public AjaxResult<Void> remove(@PathVariable Long[] userIds) {
+ public AjaxResult<Void> remove(@ApiParam("瑙掕壊ID涓�") @PathVariable Long[] userIds) {
if (ArrayUtil.contains(userIds, getUserId())) {
return error("褰撳墠鐢ㄦ埛涓嶈兘鍒犻櫎");
}
@@ -208,7 +205,7 @@
@ApiOperation("鏍规嵁鐢ㄦ埛缂栧彿鑾峰彇鎺堟潈瑙掕壊")
@PreAuthorize("@ss.hasPermi('system:user:query')")
@GetMapping("/authRole/{userId}")
- public AjaxResult<Map<String, Object>> authRole(@PathVariable("userId") Long userId) {
+ public AjaxResult<Map<String, Object>> authRole(@ApiParam("鐢ㄦ埛ID") @PathVariable("userId") Long userId) {
SysUser user = userService.selectUserById(userId);
List<SysRole> roles = roleService.selectRolesByUserId(userId);
Map<String, Object> ajax = new HashMap<>();
@@ -221,6 +218,10 @@
* 鐢ㄦ埛鎺堟潈瑙掕壊
*/
@ApiOperation("鐢ㄦ埛鎺堟潈瑙掕壊")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "userId", value = "鐢ㄦ埛Id", paramType = "query"),
+ @ApiImplicitParam(name = "roleIds", value = "瑙掕壊ID涓�", paramType = "query")
+ })
@PreAuthorize("@ss.hasPermi('system:user:edit')")
@Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.GRANT)
@PutMapping("/authRole")
diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisCacheController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisCacheController.java
index 903b982..e01b542 100644
--- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisCacheController.java
+++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisCacheController.java
@@ -28,75 +28,75 @@
@RequestMapping("/demo/cache")
public class RedisCacheController {
- /**
- * 娴嬭瘯 @Cacheable
- *
- * 琛ㄧず杩欎釜鏂规硶鏈変簡缂撳瓨鐨勫姛鑳�,鏂规硶鐨勮繑鍥炲�间細琚紦瀛樹笅鏉�
- * 涓嬩竴娆¤皟鐢ㄨ鏂规硶鍓�,浼氬幓妫�鏌ユ槸鍚︾紦瀛樹腑宸茬粡鏈夊��
- * 濡傛灉鏈夊氨鐩存帴杩斿洖,涓嶈皟鐢ㄦ柟娉�
- * 濡傛灉娌℃湁,灏辫皟鐢ㄦ柟娉�,鐒跺悗鎶婄粨鏋滅紦瀛樿捣鏉�
- * 杩欎釜娉ㄨВ銆屼竴鑸敤鍦ㄦ煡璇㈡柟娉曚笂銆�
- *
- * 閲嶇偣璇存槑: 缂撳瓨娉ㄨВ涓ヨ皑涓庡叾浠栫瓫閫夋暟鎹姛鑳戒竴璧蜂娇鐢�
- * 渚嬪: 鏁版嵁鏉冮檺娉ㄨВ 浼氶�犳垚 缂撳瓨鍑荤┛ 涓� 鏁版嵁涓嶄竴鑷撮棶棰�
- *
- * cacheNames 涓洪厤缃枃浠跺唴 groupId
- */
- @ApiOperation("娴嬭瘯 @Cacheable")
- @Cacheable(cacheNames = "redissonCacheMap", key = "#key", condition = "#key != null")
- @GetMapping("/test1")
- public AjaxResult<String> test1(String key, String value){
- return AjaxResult.success("鎿嶄綔鎴愬姛", value);
- }
+ /**
+ * 娴嬭瘯 @Cacheable
+ * <p>
+ * 琛ㄧず杩欎釜鏂规硶鏈変簡缂撳瓨鐨勫姛鑳�,鏂规硶鐨勮繑鍥炲�间細琚紦瀛樹笅鏉�
+ * 涓嬩竴娆¤皟鐢ㄨ鏂规硶鍓�,浼氬幓妫�鏌ユ槸鍚︾紦瀛樹腑宸茬粡鏈夊��
+ * 濡傛灉鏈夊氨鐩存帴杩斿洖,涓嶈皟鐢ㄦ柟娉�
+ * 濡傛灉娌℃湁,灏辫皟鐢ㄦ柟娉�,鐒跺悗鎶婄粨鏋滅紦瀛樿捣鏉�
+ * 杩欎釜娉ㄨВ銆屼竴鑸敤鍦ㄦ煡璇㈡柟娉曚笂銆�
+ * <p>
+ * 閲嶇偣璇存槑: 缂撳瓨娉ㄨВ涓ヨ皑涓庡叾浠栫瓫閫夋暟鎹姛鑳戒竴璧蜂娇鐢�
+ * 渚嬪: 鏁版嵁鏉冮檺娉ㄨВ 浼氶�犳垚 缂撳瓨鍑荤┛ 涓� 鏁版嵁涓嶄竴鑷撮棶棰�
+ * <p>
+ * cacheNames 涓洪厤缃枃浠跺唴 groupId
+ */
+ @ApiOperation("娴嬭瘯 @Cacheable")
+ @Cacheable(cacheNames = "redissonCacheMap", key = "#key", condition = "#key != null")
+ @GetMapping("/test1")
+ public AjaxResult<String> test1(String key, String value) {
+ return AjaxResult.success("鎿嶄綔鎴愬姛", value);
+ }
- /**
- * 娴嬭瘯 @CachePut
- *
- * 鍔犱簡@CachePut娉ㄨВ鐨勬柟娉�,浼氭妸鏂规硶鐨勮繑鍥炲�紁ut鍒扮紦瀛橀噷闈㈢紦瀛樿捣鏉�,渚涘叾瀹冨湴鏂逛娇鐢�
- * 瀹冦�岄�氬父鐢ㄥ湪鏂板鏂规硶涓娿��
- *
- * cacheNames 涓� 閰嶇疆鏂囦欢鍐� groupId
- */
- @ApiOperation("娴嬭瘯 @CachePut")
- @CachePut(cacheNames = "redissonCacheMap", key = "#key", condition = "#key != null")
- @GetMapping("/test2")
- public AjaxResult<String> test2(String key, String value){
- return AjaxResult.success("鎿嶄綔鎴愬姛", value);
- }
+ /**
+ * 娴嬭瘯 @CachePut
+ * <p>
+ * 鍔犱簡@CachePut娉ㄨВ鐨勬柟娉�,浼氭妸鏂规硶鐨勮繑鍥炲�紁ut鍒扮紦瀛橀噷闈㈢紦瀛樿捣鏉�,渚涘叾瀹冨湴鏂逛娇鐢�
+ * 瀹冦�岄�氬父鐢ㄥ湪鏂板鏂规硶涓娿��
+ * <p>
+ * cacheNames 涓� 閰嶇疆鏂囦欢鍐� groupId
+ */
+ @ApiOperation("娴嬭瘯 @CachePut")
+ @CachePut(cacheNames = "redissonCacheMap", key = "#key", condition = "#key != null")
+ @GetMapping("/test2")
+ public AjaxResult<String> test2(String key, String value) {
+ return AjaxResult.success("鎿嶄綔鎴愬姛", value);
+ }
- /**
- * 娴嬭瘯 @CacheEvict
- *
- * 浣跨敤浜咰acheEvict娉ㄨВ鐨勬柟娉�,浼氭竻绌烘寚瀹氱紦瀛�
- * 銆屼竴鑸敤鍦ㄦ洿鏂版垨鑰呭垹闄ょ殑鏂规硶涓娿��
- *
- * cacheNames 涓� 閰嶇疆鏂囦欢鍐� groupId
- */
- @ApiOperation("娴嬭瘯 @CacheEvict")
- @CacheEvict(cacheNames = "redissonCacheMap", key = "#key", condition = "#key != null")
- @GetMapping("/test3")
- public AjaxResult<String> test3(String key, String value){
- return AjaxResult.success("鎿嶄綔鎴愬姛", value);
- }
+ /**
+ * 娴嬭瘯 @CacheEvict
+ * <p>
+ * 浣跨敤浜咰acheEvict娉ㄨВ鐨勬柟娉�,浼氭竻绌烘寚瀹氱紦瀛�
+ * 銆屼竴鑸敤鍦ㄦ洿鏂版垨鑰呭垹闄ょ殑鏂规硶涓娿��
+ * <p>
+ * cacheNames 涓� 閰嶇疆鏂囦欢鍐� groupId
+ */
+ @ApiOperation("娴嬭瘯 @CacheEvict")
+ @CacheEvict(cacheNames = "redissonCacheMap", key = "#key", condition = "#key != null")
+ @GetMapping("/test3")
+ public AjaxResult<String> test3(String key, String value) {
+ return AjaxResult.success("鎿嶄綔鎴愬姛", value);
+ }
- /**
- * 娴嬭瘯璁剧疆杩囨湡鏃堕棿
- * 鎵嬪姩璁剧疆杩囨湡鏃堕棿10绉�
- * 11绉掑悗鑾峰彇 鍒ゆ柇鏄惁鐩哥瓑
- */
- @ApiOperation("娴嬭瘯璁剧疆杩囨湡鏃堕棿")
- @GetMapping("/test6")
- public AjaxResult<Boolean> test6(String key, String value){
- RedisUtils.setCacheObject(key, value);
- boolean flag = RedisUtils.expire(key, 10, TimeUnit.SECONDS);
- System.out.println("***********" + flag);
- try {
- Thread.sleep(11 * 1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- Object obj = RedisUtils.getCacheObject(key);
- return AjaxResult.success("鎿嶄綔鎴愬姛", value.equals(obj));
- }
+ /**
+ * 娴嬭瘯璁剧疆杩囨湡鏃堕棿
+ * 鎵嬪姩璁剧疆杩囨湡鏃堕棿10绉�
+ * 11绉掑悗鑾峰彇 鍒ゆ柇鏄惁鐩哥瓑
+ */
+ @ApiOperation("娴嬭瘯璁剧疆杩囨湡鏃堕棿")
+ @GetMapping("/test6")
+ public AjaxResult<Boolean> test6(String key, String value) {
+ RedisUtils.setCacheObject(key, value);
+ boolean flag = RedisUtils.expire(key, 10, TimeUnit.SECONDS);
+ System.out.println("***********" + flag);
+ try {
+ Thread.sleep(11 * 1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ Object obj = RedisUtils.getCacheObject(key);
+ return AjaxResult.success("鎿嶄綔鎴愬姛", value.equals(obj));
+ }
}
diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisLockController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisLockController.java
index a720246..b2d66f5 100644
--- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisLockController.java
+++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisLockController.java
@@ -28,59 +28,59 @@
@RequestMapping("/demo/redisLock")
public class RedisLockController {
- @Autowired
- private LockTemplate lockTemplate;
+ @Autowired
+ private LockTemplate lockTemplate;
- /**
- * 娴嬭瘯lock4j 娉ㄨВ
- */
- @ApiOperation("娴嬭瘯lock4j 娉ㄨВ")
- @Lock4j(keys = {"#key"})
- @GetMapping("/testLock4j")
- public AjaxResult<String> testLock4j(String key,String value){
- System.out.println("start:"+key+",time:"+ LocalTime.now().toString());
- try {
- Thread.sleep(10000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- System.out.println("end :"+key+",time:"+LocalTime.now().toString());
- return AjaxResult.success("鎿嶄綔鎴愬姛",value);
- }
+ /**
+ * 娴嬭瘯lock4j 娉ㄨВ
+ */
+ @ApiOperation("娴嬭瘯lock4j 娉ㄨВ")
+ @Lock4j(keys = {"#key"})
+ @GetMapping("/testLock4j")
+ public AjaxResult<String> testLock4j(String key, String value) {
+ System.out.println("start:" + key + ",time:" + LocalTime.now().toString());
+ try {
+ Thread.sleep(10000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ System.out.println("end :" + key + ",time:" + LocalTime.now().toString());
+ return AjaxResult.success("鎿嶄綔鎴愬姛", value);
+ }
- /**
- * 娴嬭瘯lock4j 宸ュ叿
- */
- @ApiOperation("娴嬭瘯lock4j 宸ュ叿")
- @GetMapping("/testLock4jLockTemaplate")
- public AjaxResult<String> testLock4jLockTemaplate(String key,String value){
- final LockInfo lockInfo = lockTemplate.lock(key, 30000L, 5000L, RedissonLockExecutor.class);
- if (null == lockInfo) {
- throw new RuntimeException("涓氬姟澶勭悊涓�,璇风◢鍚庡啀璇�");
- }
- // 鑾峰彇閿佹垚鍔燂紝澶勭悊涓氬姟
- try {
- try {
- Thread.sleep(8000);
- } catch (InterruptedException e) {
- //
- }
- System.out.println("鎵ц绠�鍗曟柟娉�1 , 褰撳墠绾跨▼:" + Thread.currentThread().getName());
- } finally {
- //閲婃斁閿�
- lockTemplate.releaseLock(lockInfo);
- }
- //缁撴潫
- return AjaxResult.success("鎿嶄綔鎴愬姛",value);
- }
+ /**
+ * 娴嬭瘯lock4j 宸ュ叿
+ */
+ @ApiOperation("娴嬭瘯lock4j 宸ュ叿")
+ @GetMapping("/testLock4jLockTemaplate")
+ public AjaxResult<String> testLock4jLockTemaplate(String key, String value) {
+ final LockInfo lockInfo = lockTemplate.lock(key, 30000L, 5000L, RedissonLockExecutor.class);
+ if (null == lockInfo) {
+ throw new RuntimeException("涓氬姟澶勭悊涓�,璇风◢鍚庡啀璇�");
+ }
+ // 鑾峰彇閿佹垚鍔燂紝澶勭悊涓氬姟
+ try {
+ try {
+ Thread.sleep(8000);
+ } catch (InterruptedException e) {
+ //
+ }
+ System.out.println("鎵ц绠�鍗曟柟娉�1 , 褰撳墠绾跨▼:" + Thread.currentThread().getName());
+ } finally {
+ //閲婃斁閿�
+ lockTemplate.releaseLock(lockInfo);
+ }
+ //缁撴潫
+ return AjaxResult.success("鎿嶄綔鎴愬姛", value);
+ }
- /**
- * 娴嬭瘯spring-cache娉ㄨВ
- */
- @ApiOperation("娴嬭瘯spring-cache娉ㄨВ")
- @Cacheable(value = "test", key = "#key")
- @GetMapping("/testCache")
- public AjaxResult<String> testCache(String key) {
- return AjaxResult.success("鎿嶄綔鎴愬姛", key);
- }
+ /**
+ * 娴嬭瘯spring-cache娉ㄨВ
+ */
+ @ApiOperation("娴嬭瘯spring-cache娉ㄨВ")
+ @Cacheable(value = "test", key = "#key")
+ @GetMapping("/testCache")
+ public AjaxResult<String> testCache(String key) {
+ return AjaxResult.success("鎿嶄綔鎴愬姛", key);
+ }
}
diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisPubSubController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisPubSubController.java
index 810b307..619a690 100644
--- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisPubSubController.java
+++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisPubSubController.java
@@ -4,6 +4,7 @@
import com.ruoyi.common.utils.RedisUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -21,22 +22,22 @@
@RequestMapping("/demo/redis/pubsub")
public class RedisPubSubController {
- @ApiOperation("鍙戝竷娑堟伅")
- @GetMapping("/pub")
- public AjaxResult<Void> pub(String key, String value){
- RedisUtils.publish(key, value, consumer -> {
- System.out.println("鍙戝竷閫氶亾 => " + key + ", 鍙戦�佸�� => " + value);
- });
- return AjaxResult.success("鎿嶄綔鎴愬姛");
- }
+ @ApiOperation("鍙戝竷娑堟伅")
+ @GetMapping("/pub")
+ public AjaxResult<Void> pub(@ApiParam("閫氶亾Key") String key, @ApiParam("鍙戦�佸唴瀹�") String value) {
+ RedisUtils.publish(key, value, consumer -> {
+ System.out.println("鍙戝竷閫氶亾 => " + key + ", 鍙戦�佸�� => " + value);
+ });
+ return AjaxResult.success("鎿嶄綔鎴愬姛");
+ }
- @ApiOperation("璁㈤槄娑堟伅")
- @GetMapping("/sub")
- public AjaxResult<Void> sub(String key){
- RedisUtils.subscribe(key, String.class, msg -> {
- System.out.println("璁㈤槄閫氶亾 => " + key + ", 鎺ユ敹鍊� => " + msg);
- });
- return AjaxResult.success("鎿嶄綔鎴愬姛");
- }
+ @ApiOperation("璁㈤槄娑堟伅")
+ @GetMapping("/sub")
+ public AjaxResult<Void> sub(@ApiParam("閫氶亾Key") String key) {
+ RedisUtils.subscribe(key, String.class, msg -> {
+ System.out.println("璁㈤槄閫氶亾 => " + key + ", 鎺ユ敹鍊� => " + msg);
+ });
+ return AjaxResult.success("鎿嶄綔鎴愬姛");
+ }
}
diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisRateLimiterController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisRateLimiterController.java
index 33d7509..1eeab61 100644
--- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisRateLimiterController.java
+++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/RedisRateLimiterController.java
@@ -22,37 +22,37 @@
@RequestMapping("/demo/rateLimiter")
public class RedisRateLimiterController {
- /**
- * 娴嬭瘯鍏ㄥ眬闄愭祦
- * 鍏ㄥ眬褰卞搷
- */
- @ApiOperation("娴嬭瘯鍏ㄥ眬闄愭祦")
- @RateLimiter(count = 2, time = 10)
- @GetMapping("/test")
- public AjaxResult<String> test(String value){
- return AjaxResult.success("鎿嶄綔鎴愬姛",value);
- }
+ /**
+ * 娴嬭瘯鍏ㄥ眬闄愭祦
+ * 鍏ㄥ眬褰卞搷
+ */
+ @ApiOperation("娴嬭瘯鍏ㄥ眬闄愭祦")
+ @RateLimiter(count = 2, time = 10)
+ @GetMapping("/test")
+ public AjaxResult<String> test(String value) {
+ return AjaxResult.success("鎿嶄綔鎴愬姛", value);
+ }
- /**
- * 娴嬭瘯璇锋眰IP闄愭祦
- * 鍚屼竴IP璇锋眰鍙楀奖鍝�
- */
- @ApiOperation("娴嬭瘯璇锋眰IP闄愭祦")
- @RateLimiter(count = 2, time = 10, limitType = LimitType.IP)
- @GetMapping("/testip")
- public AjaxResult<String> testip(String value){
- return AjaxResult.success("鎿嶄綔鎴愬姛",value);
- }
+ /**
+ * 娴嬭瘯璇锋眰IP闄愭祦
+ * 鍚屼竴IP璇锋眰鍙楀奖鍝�
+ */
+ @ApiOperation("娴嬭瘯璇锋眰IP闄愭祦")
+ @RateLimiter(count = 2, time = 10, limitType = LimitType.IP)
+ @GetMapping("/testip")
+ public AjaxResult<String> testip(String value) {
+ return AjaxResult.success("鎿嶄綔鎴愬姛", value);
+ }
- /**
- * 娴嬭瘯闆嗙兢瀹炰緥闄愭祦
- * 鍚姩涓や釜鍚庣鏈嶅姟浜掍笉褰卞搷
- */
- @ApiOperation("娴嬭瘯闆嗙兢瀹炰緥闄愭祦")
- @RateLimiter(count = 2, time = 10, limitType = LimitType.CLUSTER)
- @GetMapping("/testcluster")
- public AjaxResult<String> testcluster(String value){
- return AjaxResult.success("鎿嶄綔鎴愬姛",value);
- }
+ /**
+ * 娴嬭瘯闆嗙兢瀹炰緥闄愭祦
+ * 鍚姩涓や釜鍚庣鏈嶅姟浜掍笉褰卞搷
+ */
+ @ApiOperation("娴嬭瘯闆嗙兢瀹炰緥闄愭祦")
+ @RateLimiter(count = 2, time = 10, limitType = LimitType.CLUSTER)
+ @GetMapping("/testcluster")
+ public AjaxResult<String> testcluster(String value) {
+ return AjaxResult.success("鎿嶄綔鎴愬姛", value);
+ }
}
diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/Swagger3DemoController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/Swagger3DemoController.java
index a8efb64..6b73d64 100644
--- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/Swagger3DemoController.java
+++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/Swagger3DemoController.java
@@ -21,18 +21,18 @@
@RequestMapping("/swagger/demo")
public class Swagger3DemoController {
- /**
- * 涓婁紶璇锋眰
- * 蹇呴』浣跨敤 @RequestPart 娉ㄨВ鏍囨敞涓烘枃浠�
- * dataType 蹇呴』涓� "java.io.File"
- */
- @ApiOperation(value = "閫氱敤涓婁紶璇锋眰")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "file", value = "鏂囦欢", dataType = "java.io.File", required = true),
- })
- @PostMapping(value = "/upload")
- public AjaxResult<String> upload(@RequestPart("file") MultipartFile file) {
- return AjaxResult.success("鎿嶄綔鎴愬姛", file.getOriginalFilename());
- }
+ /**
+ * 涓婁紶璇锋眰
+ * 蹇呴』浣跨敤 @RequestPart 娉ㄨВ鏍囨敞涓烘枃浠�
+ * dataType 蹇呴』涓� "java.io.File"
+ */
+ @ApiOperation(value = "閫氱敤涓婁紶璇锋眰")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "file", value = "鏂囦欢", dataType = "java.io.File", required = true),
+ })
+ @PostMapping(value = "/upload")
+ public AjaxResult<String> upload(@RequestPart("file") MultipartFile file) {
+ return AjaxResult.success("鎿嶄綔鎴愬姛", file.getOriginalFilename());
+ }
}
diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestBatchController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestBatchController.java
index ef117a1..d6e691d 100644
--- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestBatchController.java
+++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestBatchController.java
@@ -34,48 +34,48 @@
/**
* 鏂板鎵归噺鏂规硶 鍙畬缇庢浛浠� saveBatch 绉掔骇鎻掑叆涓婁竾鏁版嵁 (瀵筸ysql璐熻嵎杈冨ぇ)
*/
- @ApiOperation(value = "鏂板鎵归噺鏂规硶")
+ @ApiOperation(value = "鏂板鎵归噺鏂规硶")
@PostMapping("/add")
// @DataSource(DataSourceType.SLAVE)
public AjaxResult<Void> add() {
- List<TestDemo> list = new ArrayList<>();
- for (int i = 0; i < 1000; i++) {
- list.add(new TestDemo().setOrderNum(-1L).setTestKey("鎵归噺鏂板").setValue("娴嬭瘯鏂板"));
- }
+ List<TestDemo> list = new ArrayList<>();
+ for (int i = 0; i < 1000; i++) {
+ list.add(new TestDemo().setOrderNum(-1L).setTestKey("鎵归噺鏂板").setValue("娴嬭瘯鏂板"));
+ }
return toAjax(iTestDemoService.saveAll(list) ? 1 : 0);
}
- /**
- * 鏂板鎴栨洿鏂� 鍙畬缇庢浛浠� saveOrUpdateBatch 楂樻�ц兘
- */
- @ApiOperation(value = "鏂板鎴栨洿鏂版壒閲忔柟娉�")
- @PostMapping("/addOrUpdate")
+ /**
+ * 鏂板鎴栨洿鏂� 鍙畬缇庢浛浠� saveOrUpdateBatch 楂樻�ц兘
+ */
+ @ApiOperation(value = "鏂板鎴栨洿鏂版壒閲忔柟娉�")
+ @PostMapping("/addOrUpdate")
// @DataSource(DataSourceType.SLAVE)
- public AjaxResult<Void> addOrUpdate() {
- List<TestDemo> list = new ArrayList<>();
- for (int i = 0; i < 1000; i++) {
- list.add(new TestDemo().setOrderNum(-1L).setTestKey("鎵归噺鏂板").setValue("娴嬭瘯鏂板"));
- }
- iTestDemoService.saveAll(list);
- for (int i = 0; i < list.size(); i++) {
- TestDemo testDemo = list.get(i);
- testDemo.setTestKey("鎵归噺鏂板鎴栦慨鏀�").setValue("鎵归噺鏂板鎴栦慨鏀�");
- if (i % 2 == 0) {
- testDemo.setId(null);
- }
- }
- return toAjax(iTestDemoService.saveOrUpdateAll(list) ? 1 : 0);
- }
+ public AjaxResult<Void> addOrUpdate() {
+ List<TestDemo> list = new ArrayList<>();
+ for (int i = 0; i < 1000; i++) {
+ list.add(new TestDemo().setOrderNum(-1L).setTestKey("鎵归噺鏂板").setValue("娴嬭瘯鏂板"));
+ }
+ iTestDemoService.saveAll(list);
+ for (int i = 0; i < list.size(); i++) {
+ TestDemo testDemo = list.get(i);
+ testDemo.setTestKey("鎵归噺鏂板鎴栦慨鏀�").setValue("鎵归噺鏂板鎴栦慨鏀�");
+ if (i % 2 == 0) {
+ testDemo.setId(null);
+ }
+ }
+ return toAjax(iTestDemoService.saveOrUpdateAll(list) ? 1 : 0);
+ }
/**
* 鍒犻櫎鎵归噺鏂规硶
*/
- @ApiOperation(value = "鍒犻櫎鎵归噺鏂规硶")
+ @ApiOperation(value = "鍒犻櫎鎵归噺鏂规硶")
@DeleteMapping()
// @DataSource(DataSourceType.SLAVE)
public AjaxResult<Void> remove() {
return toAjax(iTestDemoService.remove(new LambdaQueryWrapper<TestDemo>()
- .eq(TestDemo::getOrderNum, -1L)) ? 1 : 0);
+ .eq(TestDemo::getOrderNum, -1L)) ? 1 : 0);
}
}
diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java
index 692b567..7b70360 100644
--- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java
+++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestDemoController.java
@@ -16,6 +16,7 @@
import com.ruoyi.demo.service.ITestDemoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -54,17 +55,17 @@
return iTestDemoService.queryPageList(bo);
}
- /**
- * 鑷畾涔夊垎椤垫煡璇�
- */
- @ApiOperation("鑷畾涔夊垎椤垫煡璇�")
- @PreAuthorize("@ss.hasPermi('demo:demo:list')")
- @GetMapping("/page")
- public TableDataInfo<TestDemoVo> page(@Validated(QueryGroup.class) TestDemoBo bo) {
- return iTestDemoService.customPageList(bo);
- }
+ /**
+ * 鑷畾涔夊垎椤垫煡璇�
+ */
+ @ApiOperation("鑷畾涔夊垎椤垫煡璇�")
+ @PreAuthorize("@ss.hasPermi('demo:demo:list')")
+ @GetMapping("/page")
+ public TableDataInfo<TestDemoVo> page(@Validated(QueryGroup.class) TestDemoBo bo) {
+ return iTestDemoService.customPageList(bo);
+ }
- /**
+ /**
* 瀵煎嚭娴嬭瘯鍗曡〃鍒楄〃
*/
@ApiOperation("瀵煎嚭娴嬭瘯鍗曡〃鍒楄〃")
@@ -73,11 +74,11 @@
@PostMapping("/export")
public void export(@Validated TestDemoBo bo, HttpServletResponse response) {
List<TestDemoVo> list = iTestDemoService.queryList(bo);
- // 娴嬭瘯闆姳id瀵煎嚭
+ // 娴嬭瘯闆姳id瀵煎嚭
// for (TestDemoVo vo : list) {
// vo.setId(1234567891234567893L);
// }
- ExcelUtil.exportExcel(list, "娴嬭瘯鍗曡〃", TestDemoVo.class, response);
+ ExcelUtil.exportExcel(list, "娴嬭瘯鍗曡〃", TestDemoVo.class, response);
}
/**
@@ -86,8 +87,9 @@
@ApiOperation("鑾峰彇娴嬭瘯鍗曡〃璇︾粏淇℃伅")
@PreAuthorize("@ss.hasPermi('demo:demo:query')")
@GetMapping("/{id}")
- public AjaxResult<TestDemoVo> getInfo(@NotNull(message = "涓婚敭涓嶈兘涓虹┖")
- @PathVariable("id") Long id) {
+ public AjaxResult<TestDemoVo> getInfo(@ApiParam("娴嬭瘯ID")
+ @NotNull(message = "涓婚敭涓嶈兘涓虹┖")
+ @PathVariable("id") Long id) {
return AjaxResult.success(iTestDemoService.queryById(id));
}
@@ -123,10 +125,11 @@
*/
@ApiOperation("鍒犻櫎娴嬭瘯鍗曡〃")
@PreAuthorize("@ss.hasPermi('demo:demo:remove')")
- @Log(title = "娴嬭瘯鍗曡〃" , businessType = BusinessType.DELETE)
+ @Log(title = "娴嬭瘯鍗曡〃", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
- public AjaxResult<Void> remove(@NotEmpty(message = "涓婚敭涓嶈兘涓虹┖")
- @PathVariable Long[] ids) {
+ public AjaxResult<Void> remove(@ApiParam("娴嬭瘯ID涓�")
+ @NotEmpty(message = "涓婚敭涓嶈兘涓虹┖")
+ @PathVariable Long[] ids) {
return toAjax(iTestDemoService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
}
}
diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestI18nController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestI18nController.java
index bb0695f..c2ab031 100644
--- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestI18nController.java
+++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestI18nController.java
@@ -4,6 +4,7 @@
import com.ruoyi.common.utils.MessageUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -27,7 +28,7 @@
*/
@ApiOperation("閫氳繃code鑾峰彇鍥介檯鍖栧唴瀹�")
@GetMapping()
- public AjaxResult<Void> get(String code) {
+ public AjaxResult<Void> get(@ApiParam("鍥介檯鍖朿ode") String code) {
return AjaxResult.success(MessageUtils.message(code));
}
}
diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java
index c34c77c..463ea3b 100644
--- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java
+++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestTreeController.java
@@ -14,6 +14,7 @@
import com.ruoyi.demo.service.ITestTreeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -61,7 +62,7 @@
@GetMapping("/export")
public void export(@Validated TestTreeBo bo, HttpServletResponse response) {
List<TestTreeVo> list = iTestTreeService.queryList(bo);
- ExcelUtil.exportExcel(list, "娴嬭瘯鏍戣〃", TestTreeVo.class, response);
+ ExcelUtil.exportExcel(list, "娴嬭瘯鏍戣〃", TestTreeVo.class, response);
}
/**
@@ -70,8 +71,9 @@
@ApiOperation("鑾峰彇娴嬭瘯鏍戣〃璇︾粏淇℃伅")
@PreAuthorize("@ss.hasPermi('demo:tree:query')")
@GetMapping("/{id}")
- public AjaxResult<TestTreeVo> getInfo(@NotNull(message = "涓婚敭涓嶈兘涓虹┖")
- @PathVariable("id") Long id) {
+ public AjaxResult<TestTreeVo> getInfo(@ApiParam("娴嬭瘯鏍慖D")
+ @NotNull(message = "涓婚敭涓嶈兘涓虹┖")
+ @PathVariable("id") Long id) {
return AjaxResult.success(iTestTreeService.queryById(id));
}
@@ -104,10 +106,11 @@
*/
@ApiOperation("鍒犻櫎娴嬭瘯鏍戣〃")
@PreAuthorize("@ss.hasPermi('demo:tree:remove')")
- @Log(title = "娴嬭瘯鏍戣〃" , businessType = BusinessType.DELETE)
+ @Log(title = "娴嬭瘯鏍戣〃", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
- public AjaxResult<Void> remove(@NotEmpty(message = "涓婚敭涓嶈兘涓虹┖")
- @PathVariable Long[] ids) {
+ public AjaxResult<Void> remove(@ApiParam("娴嬭瘯鏍慖D涓�")
+ @NotEmpty(message = "涓婚敭涓嶈兘涓虹┖")
+ @PathVariable Long[] ids) {
return toAjax(iTestTreeService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
}
}
diff --git a/ruoyi-generator/src/main/resources/vm/java/controller.java.vm b/ruoyi-generator/src/main/resources/vm/java/controller.java.vm
index 2c8caa4..ae6f818 100644
--- a/ruoyi-generator/src/main/resources/vm/java/controller.java.vm
+++ b/ruoyi-generator/src/main/resources/vm/java/controller.java.vm
@@ -28,6 +28,7 @@
#elseif($table.tree)
#end
import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiOperation;
/**
@@ -80,7 +81,8 @@
@ApiOperation("鑾峰彇${functionName}璇︾粏淇℃伅")
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:query')")
@GetMapping("/{${pkColumn.javaField}}")
- public AjaxResult<${ClassName}Vo> getInfo(@NotNull(message = "涓婚敭涓嶈兘涓虹┖")
+ public AjaxResult<${ClassName}Vo> getInfo(@ApiParam("涓婚敭")
+ @NotNull(message = "涓婚敭涓嶈兘涓虹┖")
@PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) {
return AjaxResult.success(i${ClassName}Service.queryById(${pkColumn.javaField}));
}
@@ -116,7 +118,8 @@
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')")
@Log(title = "${functionName}" , businessType = BusinessType.DELETE)
@DeleteMapping("/{${pkColumn.javaField}s}")
- public AjaxResult<Void> remove(@NotEmpty(message = "涓婚敭涓嶈兘涓虹┖")
+ public AjaxResult<Void> remove(@ApiParam("涓婚敭涓�")
+ @NotEmpty(message = "涓婚敭涓嶈兘涓虹┖")
@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) {
return toAjax(i${ClassName}Service.deleteWithValidByIds(Arrays.asList(${pkColumn.javaField}s), true) ? 1 : 0);
}
--
Gitblit v1.9.3