From dd25573ebce3450d90d0012a30b12a5185bc7310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Fri, 8 Jul 2022 15:49:15 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BD=BF=E7=94=A8=20@param=20?= =?UTF-8?q?=E6=B3=A8=E9=87=8A=E6=9B=BF=E6=8D=A2=20@Parameter=20=E6=B3=A8?= =?UTF-8?q?=E8=A7=A3=20fix=20=E4=BF=AE=E5=A4=8D=20token=20=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E4=BC=A0=E9=80=92=20=E4=B8=8E=20=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E6=8C=81=E4=B9=85=E5=8C=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 5 +++ .../controller/common/CaptchaController.java | 8 ++-- .../controller/monitor/CacheController.java | 32 +++++++++++++- .../monitor/SysLogininforController.java | 14 ++++++- .../monitor/SysOperlogController.java | 14 ++++++- .../monitor/SysUserOnlineController.java | 12 +++++- .../system/SysConfigController.java | 18 +++++--- .../controller/system/SysDeptController.java | 19 ++++++--- .../system/SysDictDataController.java | 21 +++++++--- .../system/SysDictTypeController.java | 17 ++++++-- .../controller/system/SysLoginController.java | 5 ++- .../controller/system/SysMenuController.java | 15 ++++--- .../system/SysNoticeController.java | 11 +++-- .../system/SysOssConfigController.java | 19 +++++---- .../controller/system/SysOssController.java | 33 ++++++++------- .../controller/system/SysPostController.java | 12 ++++-- .../system/SysProfileController.java | 28 ++++++------- .../system/SysRegisterController.java | 5 ++- .../controller/system/SysRoleController.java | 33 ++++++++------- .../controller/system/SysUserController.java | 42 ++++++++++++------- .../src/main/resources/application.yml | 9 +--- .../ruoyi/demo/controller/MailController.java | 27 ++++++++---- .../demo/controller/RedisCacheController.java | 3 +- .../demo/controller/RedisLockController.java | 2 +- .../controller/RedisPubSubController.java | 18 ++++++-- .../RedisRateLimiterController.java | 2 +- .../ruoyi/demo/controller/SmsController.java | 21 +++++++--- .../controller/Swagger3DemoController.java | 13 +++--- .../demo/controller/TestBatchController.java | 5 ++- .../demo/controller/TestDemoController.java | 30 ++++++------- .../demo/controller/TestExcelController.java | 42 +++++++++---------- .../demo/controller/TestI18nController.java | 7 ++-- .../controller/TestSensitiveController.java | 2 +- .../demo/controller/TestTreeController.java | 17 ++++---- .../queue/BoundedQueueController.java | 26 +++++++++--- .../queue/DelayedQueueController.java | 37 ++++++++++++---- .../queue/PriorityQueueController.java | 28 +++++++++---- .../ruoyi/framework/config/SwaggerConfig.java | 7 ++++ .../generator/controller/GenController.java | 18 ++++++++ .../main/resources/vm/java/controller.java.vm | 14 ++++--- 40 files changed, 464 insertions(+), 227 deletions(-) diff --git a/pom.xml b/pom.xml index 8d9a17fa9..4f592194b 100644 --- a/pom.xml +++ b/pom.xml @@ -343,6 +343,11 @@ lombok 1.18.24 + + org.springframework.boot + spring-boot-configuration-processor + ${spring-boot.version} + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java index c80315f35..f2279dbef 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java @@ -19,7 +19,6 @@ import com.ruoyi.sms.config.properties.SmsProperties; import com.ruoyi.sms.core.SmsTemplate; import com.ruoyi.sms.entity.SmsResult; import com.ruoyi.system.service.ISysConfigService; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -40,7 +39,7 @@ import java.util.Map; @Anonymous @Slf4j @Validated -@Tag(name ="验证码操作处理", description = "验证码管理") +@Tag(name = "验证码操作处理", description = "验证码管理") @RequiredArgsConstructor @RestController public class CaptchaController { @@ -51,10 +50,11 @@ public class CaptchaController { /** * 短信验证码 + * + * @param phonenumber 用户手机号 */ @GetMapping("/captchaSms") - public R smsCaptcha(@Parameter(name = "用户手机号") - @NotBlank(message = "{user.phonenumber.not.blank}") + public R smsCaptcha(@NotBlank(message = "{user.phonenumber.not.blank}") String phonenumber) { if (smsProperties.getEnabled()) { R.fail("当前系统没有开启短信功能!"); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java index b3944127a..849d7c3f1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/CacheController.java @@ -19,7 +19,7 @@ import java.util.*; * * @author Lion Li */ -@Tag(name ="缓存监控", description = "缓存监控管理") +@Tag(name = "缓存监控", description = "缓存监控管理") @RequiredArgsConstructor @RestController @RequestMapping("/monitor/cache") @@ -40,6 +40,9 @@ public class CacheController { CACHES.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理")); } + /** + * 获取缓存监控列表 + */ @SaCheckPermission("monitor:cache:list") @GetMapping() public R> getInfo() throws Exception { @@ -65,12 +68,20 @@ public class CacheController { return R.ok(result); } + /** + * 获取缓存监控缓存名列表 + */ @SaCheckPermission("monitor:cache:list") @GetMapping("/getNames") public R> cache() { return R.ok(CACHES); } + /** + * 获取缓存监控Key列表 + * + * @param cacheName 缓存名 + */ @SaCheckPermission("monitor:cache:list") @GetMapping("/getKeys/{cacheName}") public R> getCacheKeys(@PathVariable String cacheName) { @@ -78,6 +89,12 @@ public class CacheController { return R.ok(cacheKyes); } + /** + * 获取缓存监控缓存值详情 + * + * @param cacheName 缓存名 + * @param cacheKey 缓存key + */ @SaCheckPermission("monitor:cache:list") @GetMapping("/getValue/{cacheName}/{cacheKey}") public R getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey) { @@ -86,6 +103,11 @@ public class CacheController { return R.ok(sysCache); } + /** + * 清理缓存监控缓存名 + * + * @param cacheName 缓存名 + */ @SaCheckPermission("monitor:cache:list") @DeleteMapping("/clearCacheName/{cacheName}") public R clearCacheName(@PathVariable String cacheName) { @@ -94,6 +116,11 @@ public class CacheController { return R.ok(); } + /** + * 清理缓存监控Key + * + * @param cacheKey key名 + */ @SaCheckPermission("monitor:cache:list") @DeleteMapping("/clearCacheKey/{cacheKey}") public R clearCacheKey(@PathVariable String cacheKey) { @@ -101,6 +128,9 @@ public class CacheController { return R.ok(); } + /** + * 清理全部缓存监控 + */ @SaCheckPermission("monitor:cache:list") @DeleteMapping("/clearCacheAll") public R clearCacheAll() { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java index 4b82b4ac9..a58c54e34 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java @@ -24,7 +24,7 @@ import java.util.List; * @author Lion Li */ @Validated -@Tag(name ="系统访问记录", description = "系统访问记录管理") +@Tag(name = "系统访问记录", description = "系统访问记录管理") @RequiredArgsConstructor @RestController @RequestMapping("/monitor/logininfor") @@ -32,12 +32,18 @@ public class SysLogininforController extends BaseController { private final ISysLogininforService logininforService; + /** + * 获取系统访问记录列表 + */ @SaCheckPermission("monitor:logininfor:list") @GetMapping("/list") public TableDataInfo list(SysLogininfor logininfor, PageQuery pageQuery) { return logininforService.selectPageLogininforList(logininfor, pageQuery); } + /** + * 导出系统访问记录列表 + */ @Log(title = "登录日志", businessType = BusinessType.EXPORT) @SaCheckPermission("monitor:logininfor:export") @PostMapping("/export") @@ -46,6 +52,9 @@ public class SysLogininforController extends BaseController { ExcelUtil.exportExcel(list, "登录日志", SysLogininfor.class, response); } + /** + * 获取系统访问记录详情 + */ @SaCheckPermission("monitor:logininfor:remove") @Log(title = "登录日志", businessType = BusinessType.DELETE) @DeleteMapping("/{infoIds}") @@ -53,6 +62,9 @@ public class SysLogininforController extends BaseController { return toAjax(logininforService.deleteLogininforByIds(infoIds)); } + /** + * 清理系统访问记录 + */ @SaCheckPermission("monitor:logininfor:remove") @Log(title = "登录日志", businessType = BusinessType.CLEAN) @DeleteMapping("/clean") diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java index d7dcff4b9..717696246 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java @@ -24,7 +24,7 @@ import java.util.List; * @author Lion Li */ @Validated -@Tag(name ="操作日志记录", description = "操作日志记录管理") +@Tag(name = "操作日志记录", description = "操作日志记录管理") @RequiredArgsConstructor @RestController @RequestMapping("/monitor/operlog") @@ -32,12 +32,18 @@ public class SysOperlogController extends BaseController { private final ISysOperLogService operLogService; + /** + * 获取操作日志记录列表 + */ @SaCheckPermission("monitor:operlog:list") @GetMapping("/list") public TableDataInfo list(SysOperLog operLog, PageQuery pageQuery) { return operLogService.selectPageOperLogList(operLog, pageQuery); } + /** + * 导出操作日志记录列表 + */ @Log(title = "操作日志", businessType = BusinessType.EXPORT) @SaCheckPermission("monitor:operlog:export") @PostMapping("/export") @@ -46,6 +52,9 @@ public class SysOperlogController extends BaseController { ExcelUtil.exportExcel(list, "操作日志", SysOperLog.class, response); } + /** + * 获取操作日志记录详情 + */ @Log(title = "操作日志", businessType = BusinessType.DELETE) @SaCheckPermission("monitor:operlog:remove") @DeleteMapping("/{operIds}") @@ -53,6 +62,9 @@ public class SysOperlogController extends BaseController { return toAjax(operLogService.deleteOperLogByIds(operIds)); } + /** + * 清理操作日志记录 + */ @Log(title = "操作日志", businessType = BusinessType.CLEAN) @SaCheckPermission("monitor:operlog:remove") @DeleteMapping("/clean") diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java index f35549c04..ec611caf2 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysUserOnlineController.java @@ -28,12 +28,18 @@ import java.util.List; * * @author Lion Li */ -@Tag(name ="在线用户监控", description = "在线用户监控管理") +@Tag(name = "在线用户监控", description = "在线用户监控管理") @RequiredArgsConstructor @RestController @RequestMapping("/monitor/online") public class SysUserOnlineController extends BaseController { + /** + * 获取在线用户监控列表 + * + * @param ipaddr IP地址 + * @param userName 用户名 + */ @SaCheckPermission("monitor:online:list") @GetMapping("/list") public TableDataInfo list(String ipaddr, String userName) { @@ -55,7 +61,7 @@ public class SysUserOnlineController extends BaseController { ); } else if (StringUtils.isNotEmpty(ipaddr)) { userOnlineDTOList = StreamUtils.filter(userOnlineDTOList, userOnline -> - StringUtils.equals(ipaddr, userOnline.getIpaddr()) + StringUtils.equals(ipaddr, userOnline.getIpaddr()) ); } else if (StringUtils.isNotEmpty(userName)) { userOnlineDTOList = StreamUtils.filter(userOnlineDTOList, userOnline -> @@ -70,6 +76,8 @@ public class SysUserOnlineController extends BaseController { /** * 强退用户 + * + * @param tokenId token值 */ @SaCheckPermission("monitor:online:forceLogout") @Log(title = "在线用户", businessType = BusinessType.FORCE) 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 3e269799c..d2cdcb76a 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,7 +11,6 @@ import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.domain.SysConfig; import com.ruoyi.system.service.ISysConfigService; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; @@ -26,7 +25,7 @@ import java.util.List; * @author Lion Li */ @Validated -@Tag(name ="参数配置控制器", description = "参数配置管理") +@Tag(name = "参数配置控制器", description = "参数配置管理") @RequiredArgsConstructor @RestController @RequestMapping("/system/config") @@ -43,6 +42,9 @@ public class SysConfigController extends BaseController { return configService.selectPageConfigList(config, pageQuery); } + /** + * 导出参数配置列表 + */ @Log(title = "参数管理", businessType = BusinessType.EXPORT) @SaCheckPermission("system:config:export") @PostMapping("/export") @@ -53,18 +55,22 @@ public class SysConfigController extends BaseController { /** * 根据参数编号获取详细信息 + * + * @param configId 参数ID */ @SaCheckPermission("system:config:query") @GetMapping(value = "/{configId}") - public R getInfo(@Parameter(name = "参数ID") @PathVariable Long configId) { + public R getInfo(@PathVariable Long configId) { return R.ok(configService.selectConfigById(configId)); } /** * 根据参数键名查询参数值 + * + * @param configKey 参数Key */ @GetMapping(value = "/configKey/{configKey}") - public R getConfigKey(@Parameter(name = "参数Key") @PathVariable String configKey) { + public R getConfigKey(@PathVariable String configKey) { return R.ok(configService.selectConfigByKey(configKey)); } @@ -106,11 +112,13 @@ public class SysConfigController extends BaseController { /** * 删除参数配置 + * + * @param configIds 参数ID串 */ @SaCheckPermission("system:config:remove") @Log(title = "参数管理", businessType = BusinessType.DELETE) @DeleteMapping("/{configIds}") - public R remove(@Parameter(name = "参数ID串") @PathVariable Long[] configIds) { + public R remove(@PathVariable Long[] configIds) { configService.deleteConfigByIds(configIds); return R.ok(); } 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 3dedb11db..b17cf510f 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 @@ -11,7 +11,6 @@ import com.ruoyi.common.core.domain.entity.SysDept; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.service.ISysDeptService; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; @@ -27,7 +26,7 @@ import java.util.Map; * @author Lion Li */ @Validated -@Tag(name ="部门控制器", description = "部门管理") +@Tag(name = "部门控制器", description = "部门管理") @RequiredArgsConstructor @RestController @RequestMapping("/system/dept") @@ -47,10 +46,12 @@ public class SysDeptController extends BaseController { /** * 查询部门列表(排除节点) + * + * @param deptId 部门ID */ @SaCheckPermission("system:dept:list") @GetMapping("/list/exclude/{deptId}") - public R> excludeChild(@Parameter(name = "部门ID") @PathVariable(value = "deptId", required = false) Long deptId) { + public R> excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) { List depts = deptService.selectDeptList(new SysDept()); depts.removeIf(d -> d.getDeptId().equals(deptId) || ArrayUtil.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")); @@ -59,10 +60,12 @@ public class SysDeptController extends BaseController { /** * 根据部门编号获取详细信息 + * + * @param deptId 部门ID */ @SaCheckPermission("system:dept:query") @GetMapping(value = "/{deptId}") - public R getInfo(@Parameter(name = "部门ID") @PathVariable Long deptId) { + public R getInfo(@PathVariable Long deptId) { deptService.checkDeptDataScope(deptId); return R.ok(deptService.selectDeptById(deptId)); } @@ -78,9 +81,11 @@ public class SysDeptController extends BaseController { /** * 加载对应角色部门列表树 + * + * @param roleId 角色ID */ @GetMapping(value = "/roleDeptTreeselect/{roleId}") - public R> roleDeptTreeselect(@Parameter(name = "角色ID") @PathVariable("roleId") Long roleId) { + public R> roleDeptTreeselect(@PathVariable("roleId") Long roleId) { List depts = deptService.selectDeptList(new SysDept()); Map ajax = new HashMap<>(); ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); @@ -123,11 +128,13 @@ public class SysDeptController extends BaseController { /** * 删除部门 + * + * @param deptId 部门ID */ @SaCheckPermission("system:dept:remove") @Log(title = "部门管理", businessType = BusinessType.DELETE) @DeleteMapping("/{deptId}") - public R remove(@Parameter(name = "部门ID串") @PathVariable Long deptId) { + public R remove(@PathVariable Long deptId) { if (deptService.hasChildByDeptId(deptId)) { return R.fail("存在下级部门,不允许删除"); } 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 a659f6d20..6dfa05f8e 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,7 +12,6 @@ import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.service.ISysDictDataService; import com.ruoyi.system.service.ISysDictTypeService; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; @@ -28,7 +27,7 @@ import java.util.List; * @author Lion Li */ @Validated -@Tag(name ="数据字典信息控制器", description = "数据字典信息管理") +@Tag(name = "数据字典信息控制器", description = "数据字典信息管理") @RequiredArgsConstructor @RestController @RequestMapping("/system/dict/data") @@ -37,12 +36,18 @@ public class SysDictDataController extends BaseController { private final ISysDictDataService dictDataService; private final ISysDictTypeService dictTypeService; + /** + * 查询字典数据列表 + */ @SaCheckPermission("system:dict:list") @GetMapping("/list") public TableDataInfo list(SysDictData dictData, PageQuery pageQuery) { return dictDataService.selectPageDictDataList(dictData, pageQuery); } + /** + * 导出字典数据列表 + */ @Log(title = "字典数据", businessType = BusinessType.EXPORT) @SaCheckPermission("system:dict:export") @PostMapping("/export") @@ -53,18 +58,22 @@ public class SysDictDataController extends BaseController { /** * 查询字典数据详细 + * + * @param dictCode 字典code */ @SaCheckPermission("system:dict:query") @GetMapping(value = "/{dictCode}") - public R getInfo(@Parameter(name = "字典code") @PathVariable Long dictCode) { + public R getInfo(@PathVariable Long dictCode) { return R.ok(dictDataService.selectDictDataById(dictCode)); } /** * 根据字典类型查询字典数据信息 + * + * @param dictType 字典类型 */ @GetMapping(value = "/type/{dictType}") - public R> dictType(@Parameter(name = "字典类型") @PathVariable String dictType) { + public R> dictType(@PathVariable String dictType) { List data = dictTypeService.selectDictDataByType(dictType); if (ObjectUtil.isNull(data)) { data = new ArrayList<>(); @@ -94,11 +103,13 @@ public class SysDictDataController extends BaseController { /** * 删除字典类型 + * + * @param dictCodes 字典code串 */ @SaCheckPermission("system:dict:remove") @Log(title = "字典类型", businessType = BusinessType.DELETE) @DeleteMapping("/{dictCodes}") - public R remove(@Parameter(name = "字典code串") @PathVariable Long[] dictCodes) { + public R remove(@PathVariable Long[] dictCodes) { dictDataService.deleteDictDataByIds(dictCodes); return R.ok(); } 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 5cabe8573..3eb3480fe 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,7 +11,6 @@ import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.service.ISysDictTypeService; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; @@ -26,7 +25,7 @@ import java.util.List; * @author Lion Li */ @Validated -@Tag(name ="数据字典信息控制器", description = "数据字典信息管理") +@Tag(name = "数据字典信息控制器", description = "数据字典信息管理") @RequiredArgsConstructor @RestController @RequestMapping("/system/dict/type") @@ -34,12 +33,18 @@ public class SysDictTypeController extends BaseController { private final ISysDictTypeService dictTypeService; + /** + * 查询字典类型列表 + */ @SaCheckPermission("system:dict:list") @GetMapping("/list") public TableDataInfo list(SysDictType dictType, PageQuery pageQuery) { return dictTypeService.selectPageDictTypeList(dictType, pageQuery); } + /** + * 导出字典类型列表 + */ @Log(title = "字典类型", businessType = BusinessType.EXPORT) @SaCheckPermission("system:dict:export") @PostMapping("/export") @@ -50,10 +55,12 @@ public class SysDictTypeController extends BaseController { /** * 查询字典类型详细 + * + * @param dictId 字典ID */ @SaCheckPermission("system:dict:query") @GetMapping(value = "/{dictId}") - public R getInfo(@Parameter(name = "字典ID") @PathVariable Long dictId) { + public R getInfo(@PathVariable Long dictId) { return R.ok(dictTypeService.selectDictTypeById(dictId)); } @@ -85,11 +92,13 @@ public class SysDictTypeController extends BaseController { /** * 删除字典类型 + * + * @param dictIds 字典ID串 */ @SaCheckPermission("system:dict:remove") @Log(title = "字典类型", businessType = BusinessType.DELETE) @DeleteMapping("/{dictIds}") - public R remove(@Parameter(name = "字典ID串") @PathVariable Long[] dictIds) { + public R remove(@PathVariable Long[] dictIds) { dictTypeService.deleteDictTypeByIds(dictIds); return R.ok(); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java index 4cd9053d4..10b9dce6d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java @@ -33,7 +33,7 @@ import java.util.Set; * @author Lion Li */ @Validated -@Tag(name ="登录验证控制器", description = "登录验证管理") +@Tag(name = "登录验证控制器", description = "登录验证管理") @RequiredArgsConstructor @RestController public class SysLoginController { @@ -92,6 +92,9 @@ public class SysLoginController { return R.ok(ajax); } + /** + * 退出登录 + */ @Anonymous @PostMapping("/logout") public R logout() { 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 1e87e6707..713dfbe79 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 @@ -10,7 +10,6 @@ import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.service.ISysMenuService; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; @@ -26,7 +25,7 @@ import java.util.Map; * @author Lion Li */ @Validated -@Tag(name ="菜单信息控制器", description = "菜单信息管理") +@Tag(name = "菜单信息控制器", description = "菜单信息管理") @RequiredArgsConstructor @RestController @RequestMapping("/system/menu") @@ -46,10 +45,12 @@ public class SysMenuController extends BaseController { /** * 根据菜单编号获取详细信息 + * + * @param menuId 菜单ID */ @SaCheckPermission("system:menu:query") @GetMapping(value = "/{menuId}") - public R getInfo(@Parameter(name = "菜单ID") @PathVariable Long menuId) { + public R getInfo(@PathVariable Long menuId) { return R.ok(menuService.selectMenuById(menuId)); } @@ -64,9 +65,11 @@ public class SysMenuController extends BaseController { /** * 加载对应角色菜单列表树 + * + * @param roleId 角色ID */ @GetMapping(value = "/roleMenuTreeselect/{roleId}") - public R> roleMenuTreeselect(@Parameter(name = "角色ID") @PathVariable("roleId") Long roleId) { + public R> roleMenuTreeselect(@PathVariable("roleId") Long roleId) { List menus = menuService.selectMenuList(getUserId()); Map ajax = new HashMap<>(); ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); @@ -108,11 +111,13 @@ public class SysMenuController extends BaseController { /** * 删除菜单 + * + * @param menuId 菜单ID */ @SaCheckPermission("system:menu:remove") @Log(title = "菜单管理", businessType = BusinessType.DELETE) @DeleteMapping("/{menuId}") - public R remove(@Parameter(name = "菜单ID") @PathVariable("menuId") Long menuId) { + public R remove(@PathVariable("menuId") Long menuId) { if (menuService.hasChildByMenuId(menuId)) { return R.fail("存在子菜单,不允许删除"); } 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 10a8371c7..0e2eb58ce 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,7 +9,6 @@ import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.system.domain.SysNotice; import com.ruoyi.system.service.ISysNoticeService; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; @@ -21,7 +20,7 @@ import org.springframework.web.bind.annotation.*; * @author Lion Li */ @Validated -@Tag(name ="公告信息控制器", description = "公告信息管理") +@Tag(name = "公告信息控制器", description = "公告信息管理") @RequiredArgsConstructor @RestController @RequestMapping("/system/notice") @@ -40,10 +39,12 @@ public class SysNoticeController extends BaseController { /** * 根据通知公告编号获取详细信息 + * + * @param noticeId 公告ID */ @SaCheckPermission("system:notice:query") @GetMapping(value = "/{noticeId}") - public R getInfo(@Parameter(name = "公告ID") @PathVariable Long noticeId) { + public R getInfo(@PathVariable Long noticeId) { return R.ok(noticeService.selectNoticeById(noticeId)); } @@ -69,11 +70,13 @@ public class SysNoticeController extends BaseController { /** * 删除通知公告 + * + * @param noticeIds 公告ID串 */ @SaCheckPermission("system:notice:remove") @Log(title = "通知公告", businessType = BusinessType.DELETE) @DeleteMapping("/{noticeIds}") - public R remove(@Parameter(name = "公告ID串") @PathVariable Long[] noticeIds) { + public R remove(@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 023f349c1..c9afca001 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,7 +14,6 @@ import com.ruoyi.common.enums.BusinessType; import com.ruoyi.system.domain.bo.SysOssConfigBo; import com.ruoyi.system.domain.vo.SysOssConfigVo; import com.ruoyi.system.service.ISysOssConfigService; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; @@ -25,14 +24,14 @@ import javax.validation.constraints.NotNull; import java.util.Arrays; /** - * 对象存储配置Controller + * 对象存储配置 * * @author Lion Li * @author 孤舟烟雨 * @date 2021-08-13 */ @Validated -@Tag(name ="对象存储配置控制器", description = "对象存储配置管理") +@Tag(name = "对象存储配置控制器", description = "对象存储配置管理") @RequiredArgsConstructor @RestController @RequestMapping("/system/oss/config") @@ -51,12 +50,13 @@ public class SysOssConfigController extends BaseController { /** * 获取对象存储配置详细信息 + * + * @param ossConfigId OSS配置ID */ @SaCheckPermission("system:oss:query") @GetMapping("/{ossConfigId}") - public R getInfo(@Parameter(name = "OSS配置ID") - @NotNull(message = "主键不能为空") - @PathVariable("ossConfigId") Long ossConfigId) { + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long ossConfigId) { return R.ok(iSysOssConfigService.queryById(ossConfigId)); } @@ -84,13 +84,14 @@ public class SysOssConfigController extends BaseController { /** * 删除对象存储配置 + * + * @param ossConfigIds OSS配置ID串 */ @SaCheckPermission("system:oss:remove") @Log(title = "对象存储配置", businessType = BusinessType.DELETE) @DeleteMapping("/{ossConfigIds}") - public R remove(@Parameter(name = "OSS配置ID串") - @NotEmpty(message = "主键不能为空") - @PathVariable Long[] ossConfigIds) { + public R remove(@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 e40c2f5d7..85faa1687 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 @@ -19,9 +19,6 @@ import com.ruoyi.system.domain.SysOss; import com.ruoyi.system.domain.bo.SysOssBo; import com.ruoyi.system.domain.vo.SysOssVo; import com.ruoyi.system.service.ISysOssService; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Parameters; -import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.http.MediaType; @@ -43,7 +40,7 @@ import java.util.Map; * @author Lion Li */ @Validated -@Tag(name ="对象存储控制器", description = "对象存储管理") +@Tag(name = "对象存储控制器", description = "对象存储管理") @RequiredArgsConstructor @RestController @RequestMapping("/system/oss") @@ -62,25 +59,25 @@ public class SysOssController extends BaseController { /** * 查询OSS对象基于id串 + * + * @param ossIds OSS对象ID串 */ @SaCheckPermission("system:oss:list") @GetMapping("/listByIds/{ossIds}") - public R> listByIds(@Parameter(name = "OSS对象ID串") - @NotEmpty(message = "主键不能为空") - @PathVariable Long[] ossIds) { + public R> listByIds(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] ossIds) { List list = iSysOssService.listByIds(Arrays.asList(ossIds)); return R.ok(list); } /** * 上传OSS对象存储 + * + * @param file 文件 */ - @Parameters({ - @Parameter(name = "file", description = "文件", in = ParameterIn.QUERY, required = true) - }) @SaCheckPermission("system:oss:upload") @Log(title = "OSS对象存储", businessType = BusinessType.INSERT) - @PostMapping("/upload") + @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public R> upload(@RequestPart("file") MultipartFile file) { if (ObjectUtil.isNull(file)) { throw new ServiceException("上传文件不能为空"); @@ -93,9 +90,14 @@ public class SysOssController extends BaseController { return R.ok(map); } + /** + * 下载OSS对象 + * + * @param ossId OSS对象ID + */ @SaCheckPermission("system:oss:download") @GetMapping("/download/{ossId}") - public void download(@Parameter(name = "OSS对象ID") @PathVariable Long ossId, HttpServletResponse response) throws IOException { + public void download(@PathVariable Long ossId, HttpServletResponse response) throws IOException { SysOss sysOss = iSysOssService.getById(ossId); if (ObjectUtil.isNull(sysOss)) { throw new ServiceException("文件数据不存在!"); @@ -118,13 +120,14 @@ public class SysOssController extends BaseController { /** * 删除OSS对象存储 + * + * @param ossIds OSS对象ID串 */ @SaCheckPermission("system:oss:remove") @Log(title = "OSS对象存储", businessType = BusinessType.DELETE) @DeleteMapping("/{ossIds}") - public R remove(@Parameter(name = "OSS对象ID串") - @NotEmpty(message = "主键不能为空") - @PathVariable Long[] ossIds) { + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] ossIds) { return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true) ? 1 : 0); } 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 a78ac4bfd..5feaa6cb4 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,7 +11,6 @@ import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.domain.SysPost; import com.ruoyi.system.service.ISysPostService; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; @@ -43,6 +42,9 @@ public class SysPostController extends BaseController { return postService.selectPagePostList(post, pageQuery); } + /** + * 导出岗位列表 + */ @Log(title = "岗位管理", businessType = BusinessType.EXPORT) @SaCheckPermission("system:post:export") @PostMapping("/export") @@ -53,10 +55,12 @@ public class SysPostController extends BaseController { /** * 根据岗位编号获取详细信息 + * + * @param postId 岗位ID */ @SaCheckPermission("system:post:query") @GetMapping(value = "/{postId}") - public R getInfo(@Parameter(name = "岗位ID") @PathVariable Long postId) { + public R getInfo(@PathVariable Long postId) { return R.ok(postService.selectPostById(postId)); } @@ -92,11 +96,13 @@ public class SysPostController extends BaseController { /** * 删除岗位 + * + * @param postIds 岗位ID串 */ @SaCheckPermission("system:post:remove") @Log(title = "岗位管理", businessType = BusinessType.DELETE) @DeleteMapping("/{postIds}") - public R remove(@Parameter(name = "岗位ID串") @PathVariable Long[] postIds) { + public R remove(@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 bb63b0728..ee45ac2c3 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 @@ -14,11 +14,9 @@ import com.ruoyi.common.utils.file.MimeTypeUtils; import com.ruoyi.system.domain.SysOss; import com.ruoyi.system.service.ISysOssService; import com.ruoyi.system.service.ISysUserService; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Parameters; -import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; +import org.springframework.http.MediaType; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -33,7 +31,7 @@ import java.util.Map; * @author Lion Li */ @Validated -@Tag(name ="个人信息控制器", description = "个人信息管理") +@Tag(name = "个人信息控制器", description = "个人信息管理") @RequiredArgsConstructor @RestController @RequestMapping("/system/user/profile") @@ -80,11 +78,10 @@ public class SysProfileController extends BaseController { /** * 重置密码 + * + * @param newPassword 旧密码 + * @param oldPassword 新密码 */ - @Parameters({ - @Parameter(name = "oldPassword", description = "旧密码", in = ParameterIn.QUERY), - @Parameter(name = "newPassword", description = "新密码", in = ParameterIn.QUERY) - }) @Log(title = "个人信息", businessType = BusinessType.UPDATE) @PutMapping("/updatePwd") public R updatePwd(String oldPassword, String newPassword) { @@ -106,20 +103,19 @@ public class SysProfileController extends BaseController { /** * 头像上传 + * + * @param avatarfile 用户头像 */ - @Parameters({ - @Parameter(name = "avatarfile", description = "用户头像", in = ParameterIn.QUERY, required = true) - }) @Log(title = "用户头像", businessType = BusinessType.UPDATE) - @PostMapping("/avatar") - public R> avatar(@RequestPart("avatarfile") MultipartFile file) { + @PostMapping(value = "/avatar", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + public R> avatar(@RequestPart("avatarfile") MultipartFile avatarfile) { Map ajax = new HashMap<>(); - if (!file.isEmpty()) { - String extension = FileUtil.extName(file.getOriginalFilename()); + if (!avatarfile.isEmpty()) { + String extension = FileUtil.extName(avatarfile.getOriginalFilename()); if (!StringUtils.equalsAnyIgnoreCase(extension, MimeTypeUtils.IMAGE_EXTENSION)) { return R.fail("文件格式不正确,请上传" + Arrays.toString(MimeTypeUtils.IMAGE_EXTENSION) + "格式"); } - SysOss oss = iSysOssService.upload(file); + SysOss oss = iSysOssService.upload(avatarfile); String avatar = oss.getUrl(); if (userService.updateUserAvatar(getUsername(), avatar)) { ajax.put("imgUrl", avatar); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java index cc0596036..79b5d8602 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java @@ -19,7 +19,7 @@ import org.springframework.web.bind.annotation.RestController; * @author Lion Li */ @Validated -@Tag(name ="注册验证控制器", description = "注册验证管理") +@Tag(name = "注册验证控制器", description = "注册验证管理") @RequiredArgsConstructor @RestController public class SysRegisterController extends BaseController { @@ -27,6 +27,9 @@ public class SysRegisterController extends BaseController { private final SysRegisterService registerService; private final ISysConfigService configService; + /** + * 用户注册 + */ @Anonymous @PostMapping("/register") public R register(@Validated @RequestBody RegisterBody user) { 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 fc0e5a7d0..31694b04e 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 @@ -18,9 +18,6 @@ import com.ruoyi.system.domain.SysUserRole; import com.ruoyi.system.service.ISysRoleService; import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.SysPermissionService; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Parameters; -import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; @@ -35,7 +32,7 @@ import java.util.List; * @author Lion Li */ @Validated -@Tag(name ="角色信息控制器", description = "角色信息管理") +@Tag(name = "角色信息控制器", description = "角色信息管理") @RequiredArgsConstructor @RestController @RequestMapping("/system/role") @@ -45,12 +42,18 @@ public class SysRoleController extends BaseController { private final ISysUserService userService; private final SysPermissionService permissionService; + /** + * 获取角色信息列表 + */ @SaCheckPermission("system:role:list") @GetMapping("/list") public TableDataInfo list(SysRole role, PageQuery pageQuery) { return roleService.selectPageRoleList(role, pageQuery); } + /** + * 导出角色信息列表 + */ @Log(title = "角色管理", businessType = BusinessType.EXPORT) @SaCheckPermission("system:role:export") @PostMapping("/export") @@ -61,10 +64,12 @@ public class SysRoleController extends BaseController { /** * 根据角色编号获取详细信息 + * + * @param roleId 角色ID */ @SaCheckPermission("system:role:query") @GetMapping(value = "/{roleId}") - public R getInfo(@Parameter(name = "角色ID") @PathVariable Long roleId) { + public R getInfo(@PathVariable Long roleId) { roleService.checkRoleDataScope(roleId); return R.ok(roleService.selectRoleById(roleId)); } @@ -139,11 +144,13 @@ public class SysRoleController extends BaseController { /** * 删除角色 + * + * @param roleIds 角色ID串 */ @SaCheckPermission("system:role:remove") @Log(title = "角色管理", businessType = BusinessType.DELETE) @DeleteMapping("/{roleIds}") - public R remove(@Parameter(name = "角色ID串") @PathVariable Long[] roleIds) { + public R remove(@PathVariable Long[] roleIds) { return toAjax(roleService.deleteRoleByIds(roleIds)); } @@ -186,11 +193,10 @@ public class SysRoleController extends BaseController { /** * 批量取消授权用户 + * + * @param roleId 角色ID + * @param userIds 用户ID串 */ - @Parameters({ - @Parameter(name = "roleId", description = "角色ID", in = ParameterIn.QUERY), - @Parameter(name = "userIds", description = "用户ID串", in = ParameterIn.QUERY) - }) @SaCheckPermission("system:role:edit") @Log(title = "角色管理", businessType = BusinessType.GRANT) @PutMapping("/authUser/cancelAll") @@ -200,11 +206,10 @@ public class SysRoleController extends BaseController { /** * 批量选择用户授权 + * + * @param roleId 角色ID + * @param userIds 用户ID串 */ - @Parameters({ - @Parameter(name = "roleId", description = "角色ID", in = ParameterIn.QUERY), - @Parameter(name = "userIds", description = "用户ID串", in = ParameterIn.QUERY) - }) @SaCheckPermission("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 cb564b6cd..c32af70b9 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 @@ -26,11 +26,9 @@ import com.ruoyi.system.listener.SysUserImportListener; import com.ruoyi.system.service.ISysPostService; import com.ruoyi.system.service.ISysRoleService; import com.ruoyi.system.service.ISysUserService; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Parameters; -import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; +import org.springframework.http.MediaType; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -47,7 +45,7 @@ import java.util.Map; * @author Lion Li */ @Validated -@Tag(name ="用户信息控制器", description = "用户信息管理") +@Tag(name = "用户信息控制器", description = "用户信息管理") @RequiredArgsConstructor @RestController @RequestMapping("/system/user") @@ -66,6 +64,9 @@ public class SysUserController extends BaseController { return userService.selectPageUserList(user, pageQuery); } + /** + * 导出用户列表 + */ @Log(title = "用户管理", businessType = BusinessType.EXPORT) @SaCheckPermission("system:user:export") @PostMapping("/export") @@ -83,17 +84,23 @@ public class SysUserController extends BaseController { ExcelUtil.exportExcel(listVo, "用户数据", SysUserExportVo.class, response); } - @Parameters({ - @Parameter(name = "file", description = "导入文件", required = true), - }) + /** + * 导入数据 + * + * @param file 导入文件 + * @param updateSupport 是否更新已存在数据 + */ @Log(title = "用户管理", businessType = BusinessType.IMPORT) @SaCheckPermission("system:user:import") - @PostMapping("/importData") + @PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public R importData(@RequestPart("file") MultipartFile file, boolean updateSupport) throws Exception { ExcelResult result = ExcelUtil.importExcel(file.getInputStream(), SysUserImportVo.class, new SysUserImportListener(updateSupport)); return R.ok(result.getAnalysis()); } + /** + * 获取导入模板 + */ @PostMapping("/importTemplate") public void importTemplate(HttpServletResponse response) { ExcelUtil.exportExcel(new ArrayList<>(), "用户数据", SysUserImportVo.class, response); @@ -101,10 +108,12 @@ public class SysUserController extends BaseController { /** * 根据用户编号获取详细信息 + * + * @param userId 用户ID */ @SaCheckPermission("system:user:query") @GetMapping(value = {"/", "/{userId}"}) - public R> getInfo(@Parameter(name = "用户ID") @PathVariable(value = "userId", required = false) Long userId) { + public R> getInfo(@PathVariable(value = "userId", required = false) Long userId) { userService.checkUserDataScope(userId); Map ajax = new HashMap<>(); List roles = roleService.selectRoleAll(); @@ -160,11 +169,13 @@ public class SysUserController extends BaseController { /** * 删除用户 + * + * @param userIds 角色ID串 */ @SaCheckPermission("system:user:remove") @Log(title = "用户管理", businessType = BusinessType.DELETE) @DeleteMapping("/{userIds}") - public R remove(@Parameter(name = "角色ID串") @PathVariable Long[] userIds) { + public R remove(@PathVariable Long[] userIds) { if (ArrayUtil.contains(userIds, getUserId())) { return R.fail("当前用户不能删除"); } @@ -198,10 +209,12 @@ public class SysUserController extends BaseController { /** * 根据用户编号获取授权角色 + * + * @param userId 用户ID */ @SaCheckPermission("system:user:query") @GetMapping("/authRole/{userId}") - public R> authRole(@Parameter(name = "用户ID") @PathVariable("userId") Long userId) { + public R> authRole(@PathVariable Long userId) { SysUser user = userService.selectUserById(userId); List roles = roleService.selectRolesByUserId(userId); Map ajax = new HashMap<>(); @@ -212,11 +225,10 @@ public class SysUserController extends BaseController { /** * 用户授权角色 + * + * @param userId 用户Id + * @param roleIds 角色ID串 */ - @Parameters({ - @Parameter(name = "userId", description = "用户Id", in = ParameterIn.QUERY), - @Parameter(name = "roleIds", description = "角色ID串", in = ParameterIn.QUERY) - }) @SaCheckPermission("system:user:edit") @Log(title = "用户管理", businessType = BusinessType.GRANT) @PutMapping("/authRole") diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 3c11d01c0..74d251b63 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -206,13 +206,8 @@ springdoc: swagger-ui: # 修改Swagger UI路径 path: /doc.html - # 开启Swagger UI界面 - enabled: true - api-docs: - # 修改api-docs路径 - path: /v3/api-docs - # 开启api-docs - enabled: true + # 持久化认证数据 + persistAuthorization: true #这里定义了两个分组,可定义多个,也可以不定义 group-configs: - group: 1.演示模块 diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/MailController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/MailController.java index d86289d24..ddfca7fb5 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/MailController.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/MailController.java @@ -2,7 +2,6 @@ package com.ruoyi.demo.controller; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.utils.email.MailUtils; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; @@ -19,25 +18,35 @@ import java.io.File; * @author Michelle.Chung */ @Validated -@Tag(name ="邮件发送案例", description = "邮件发送案例") +@Tag(name = "邮件发送案例", description = "邮件发送案例") @RequiredArgsConstructor @RestController @RequestMapping("/demo/mail") public class MailController { + /** + * 发送邮件 + * + * @param to 接收人 + * @param subject 标题 + * @param text 内容 + */ @GetMapping("/sendSimpleMessage") - public R sendSimpleMessage(@Parameter(name = "接收人") String to, - @Parameter(name = "标题") String subject, - @Parameter(name = "内容") String text) { + public R sendSimpleMessage(String to, String subject, String text) { MailUtils.sendText(to, subject, text); return R.ok(); } + /** + * 发送邮件(带附件) + * + * @param to 接收人 + * @param subject 标题 + * @param text 内容 + * @param filePath 附件路径 + */ @GetMapping("/sendMessageWithAttachment") - public R sendMessageWithAttachment(@Parameter(name = "接收人") String to, - @Parameter(name = "标题") String subject, - @Parameter(name = "内容") String text, - @Parameter(name = "附件路径") String filePath) { + public R sendMessageWithAttachment(String to, String subject, String text, String filePath) { MailUtils.sendText(to, subject, text, new File(filePath)); return R.ok(); } 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 c2baa71e7..a345167cd 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 @@ -2,7 +2,6 @@ package com.ruoyi.demo.controller; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.utils.redis.RedisUtils; -import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.cache.annotation.CacheEvict; @@ -21,7 +20,7 @@ import java.time.Duration; */ // 类级别 缓存统一配置 //@CacheConfig(cacheNames = "redissonCacheMap") -@Tag(name ="spring-cache 演示案例", description = "spring-cache 演示案例") +@Tag(name = "spring-cache 演示案例", description = "spring-cache 演示案例") @RequiredArgsConstructor @RestController @RequestMapping("/demo/cache") 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 0e1bb8428..69d231d59 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 @@ -20,7 +20,7 @@ import java.time.LocalTime; * * @author shenxinquan */ -@Tag(name ="测试分布式锁的样例", description = "测试分布式锁的样例") +@Tag(name = "测试分布式锁的样例", description = "测试分布式锁的样例") @Slf4j @RestController @RequestMapping("/demo/redisLock") 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 344abc142..dae10364e 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 @@ -2,7 +2,6 @@ package com.ruoyi.demo.controller; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.utils.redis.RedisUtils; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; @@ -14,22 +13,33 @@ import org.springframework.web.bind.annotation.RestController; * * @author Lion Li */ -@Tag(name ="Redis发布订阅 演示案例", description = "Redis发布订阅") +@Tag(name = "Redis发布订阅 演示案例", description = "Redis发布订阅") @RequiredArgsConstructor @RestController @RequestMapping("/demo/redis/pubsub") public class RedisPubSubController { + /** + * 发布消息 + * + * @param key 通道Key + * @param value 发送内容 + */ @GetMapping("/pub") - public R pub(@Parameter(name = "通道Key") String key, @Parameter(name = "发送内容") String value) { + public R pub(String key, String value) { RedisUtils.publish(key, value, consumer -> { System.out.println("发布通道 => " + key + ", 发送值 => " + value); }); return R.ok("操作成功"); } + /** + * 订阅消息 + * + * @param key 通道Key + */ @GetMapping("/sub") - public R sub(@Parameter(name = "通道Key") String key) { + public R sub(String key) { RedisUtils.subscribe(key, String.class, msg -> { System.out.println("订阅通道 => " + key + ", 接收值 => " + msg); }); 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 abb59ace9..39e50348c 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 @@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RestController; * * @author Lion Li */ -@Tag(name ="测试分布式限流样例", description = "测试分布式限流样例") +@Tag(name = "测试分布式限流样例", description = "测试分布式限流样例") @Slf4j @RestController @RequestMapping("/demo/rateLimiter") diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/SmsController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/SmsController.java index a9c806174..a9c38a7f6 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/SmsController.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/SmsController.java @@ -4,7 +4,6 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.common.utils.spring.SpringUtils; import com.ruoyi.sms.config.properties.SmsProperties; import com.ruoyi.sms.core.SmsTemplate; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; @@ -23,7 +22,7 @@ import java.util.Map; * @version 4.2.0 */ @Validated -@Tag(name ="短信演示案例", description = "短信演示案例") +@Tag(name = "短信演示案例", description = "短信演示案例") @RequiredArgsConstructor @RestController @RequestMapping("/demo/sms") @@ -33,9 +32,14 @@ public class SmsController { // private final SmsTemplate smsTemplate; // 可以使用spring注入 // private final AliyunSmsTemplate smsTemplate; // 也可以注入某个厂家的模板工具 + /** + * 发送短信Aliyun + * + * @param phones 电话号 + * @param templateId 模板ID + */ @GetMapping("/sendAliyun") - public R sendAliyun(@Parameter(name = "电话号") String phones, - @Parameter(name = "模板ID") String templateId) { + public R sendAliyun(String phones, String templateId) { if (!smsProperties.getEnabled()) { return R.fail("当前系统没有开启短信功能!"); } @@ -49,9 +53,14 @@ public class SmsController { return R.ok(send); } + /** + * 发送短信Tencent + * + * @param phones 电话号 + * @param templateId 模板ID + */ @GetMapping("/sendTencent") - public R sendTencent(@Parameter(name = "电话号") String phones, - @Parameter(name = "模板ID") String templateId) { + public R sendTencent(String phones, String templateId) { if (!smsProperties.getEnabled()) { return R.fail("当前系统没有开启短信功能!"); } 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 af0e104ab..b044277d2 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 @@ -1,10 +1,8 @@ package com.ruoyi.demo.controller; import com.ruoyi.common.core.domain.R; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Parameters; -import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestPart; @@ -16,7 +14,7 @@ import org.springframework.web.multipart.MultipartFile; * * @author Lion Li */ -@Tag(name ="演示swagger3控制器", description = "演示swagger3接口") +@Tag(name = "演示swagger3控制器", description = "演示swagger3接口") @RestController @RequestMapping("/swagger/demo") public class Swagger3DemoController { @@ -24,11 +22,10 @@ public class Swagger3DemoController { /** * 上传请求 * 必须使用 @RequestPart 注解标注为文件 + * + * @param file 文件 */ - @Parameters({ - @Parameter(name = "file", description = "文件", in = ParameterIn.QUERY, required = true) - }) - @PostMapping(value = "/upload") + @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public R upload(@RequestPart("file") MultipartFile file) { return R.ok("操作成功", 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 e821eaac6..6f5e85031 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 @@ -21,7 +21,7 @@ import java.util.List; * @author Lion Li * @date 2021-05-30 */ -@Tag(name ="测试批量方法", description = "测试批量方法") +@Tag(name = "测试批量方法", description = "测试批量方法") @RequiredArgsConstructor @RestController @RequestMapping("/demo/batch") @@ -65,7 +65,8 @@ public class TestBatchController extends BaseController { testDemo.setOrderNum(-1); testDemo.setTestKey("批量新增"); testDemo.setValue("测试新增"); - list.add(testDemo); } + list.add(testDemo); + } testDemoMapper.insertBatch(list); for (int i = 0; i < list.size(); i++) { TestDemo testDemo = list.get(i); 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 50bcbd073..b4b977a84 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 @@ -20,11 +20,9 @@ import com.ruoyi.demo.domain.bo.TestDemoBo; import com.ruoyi.demo.domain.bo.TestDemoImportVo; import com.ruoyi.demo.domain.vo.TestDemoVo; import com.ruoyi.demo.service.ITestDemoService; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.Parameters; -import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; +import org.springframework.http.MediaType; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -43,7 +41,7 @@ import java.util.concurrent.TimeUnit; * @date 2021-07-26 */ @Validated -@Tag(name ="测试单表控制器", description = "测试单表管理") +@Tag(name = "测试单表控制器", description = "测试单表管理") @RequiredArgsConstructor @RestController @RequestMapping("/demo/demo") @@ -69,12 +67,14 @@ public class TestDemoController extends BaseController { return iTestDemoService.customPageList(bo, pageQuery); } - @Parameters({ - @Parameter(name = "file", description = "导入文件", in = ParameterIn.QUERY, required = true), - }) + /** + * 导入数据 + * + * @param file 导入文件 + */ @Log(title = "测试单表", businessType = BusinessType.IMPORT) @SaCheckPermission("demo:demo:import") - @PostMapping("/importData") + @PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public R importData(@RequestPart("file") MultipartFile file) throws Exception { ExcelResult excelResult = ExcelUtil.importExcel(file.getInputStream(), TestDemoImportVo.class, true); List volist = excelResult.getList(); @@ -100,12 +100,13 @@ public class TestDemoController extends BaseController { /** * 获取测试单表详细信息 + * + * @param id 测试ID */ @SaCheckPermission("demo:demo:query") @GetMapping("/{id}") - public R getInfo(@Parameter(name = "测试ID") - @NotNull(message = "主键不能为空") - @PathVariable("id") Long id) { + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable("id") Long id) { return R.ok(iTestDemoService.queryById(id)); } @@ -136,13 +137,14 @@ public class TestDemoController extends BaseController { /** * 删除测试单表 + * + * @param ids 测试ID串 */ @SaCheckPermission("demo:demo:remove") @Log(title = "测试单表", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") - public R remove(@Parameter(name = "测试ID串") - @NotEmpty(message = "主键不能为空") - @PathVariable Long[] ids) { + public R remove(@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/TestExcelController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestExcelController.java index b241cc80d..95d307b02 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestExcelController.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestExcelController.java @@ -20,7 +20,7 @@ import java.util.Map; * * @author Lion Li */ -@Tag(name ="测试Excel功能", description = "测试Excel功能") +@Tag(name = "测试Excel功能", description = "测试Excel功能") @RestController @RequestMapping("/demo/excel") public class TestExcelController { @@ -30,18 +30,18 @@ public class TestExcelController { */ @GetMapping("/exportTemplateOne") public void exportTemplateOne(HttpServletResponse response) { - Map map = new HashMap<>(); - map.put("title","单列表多数据"); - map.put("test1","数据测试1"); - map.put("test2","数据测试2"); - map.put("test3","数据测试3"); - map.put("test4","数据测试4"); - map.put("testTest","666"); + Map map = new HashMap<>(); + map.put("title", "单列表多数据"); + map.put("test1", "数据测试1"); + map.put("test2", "数据测试2"); + map.put("test3", "数据测试3"); + map.put("test4", "数据测试4"); + map.put("testTest", "666"); List list = new ArrayList<>(); list.add(new TestObj("单列表测试1", "列表测试1", "列表测试2", "列表测试3", "列表测试4")); list.add(new TestObj("单列表测试2", "列表测试5", "列表测试6", "列表测试7", "列表测试8")); list.add(new TestObj("单列表测试3", "列表测试9", "列表测试10", "列表测试11", "列表测试12")); - ExcelUtil.exportTemplate(CollUtil.newArrayList(map,list),"单列表.xlsx", "excel/单列表.xlsx", response); + ExcelUtil.exportTemplate(CollUtil.newArrayList(map, list), "单列表.xlsx", "excel/单列表.xlsx", response); } /** @@ -49,12 +49,12 @@ public class TestExcelController { */ @GetMapping("/exportTemplateMuliti") public void exportTemplateMuliti(HttpServletResponse response) { - Map map = new HashMap<>(); - map.put("title1","标题1"); - map.put("title2","标题2"); - map.put("title3","标题3"); - map.put("title4","标题4"); - map.put("author","Lion Li"); + Map map = new HashMap<>(); + map.put("title1", "标题1"); + map.put("title2", "标题2"); + map.put("title3", "标题3"); + map.put("title4", "标题4"); + map.put("author", "Lion Li"); List list1 = new ArrayList<>(); list1.add(new TestObj1("list1测试1", "list1测试2", "list1测试3")); list1.add(new TestObj1("list1测试4", "list1测试5", "list1测试6")); @@ -69,12 +69,12 @@ public class TestExcelController { list4.add(new TestObj1("list4测试4", "list4测试5", "list4测试6")); list4.add(new TestObj1("list4测试7", "list4测试8", "list4测试9")); list4.add(new TestObj1("list4测试10", "list4测试11", "list4测试12")); - Map multiListMap = new HashMap<>(); - multiListMap.put("map",map); - multiListMap.put("data1",list1); - multiListMap.put("data2",list2); - multiListMap.put("data3",list3); - multiListMap.put("data4",list4); + Map multiListMap = new HashMap<>(); + multiListMap.put("map", map); + multiListMap.put("data1", list1); + multiListMap.put("data2", list2); + multiListMap.put("data3", list3); + multiListMap.put("data4", list4); ExcelUtil.exportTemplateMultiList(multiListMap, "多列表.xlsx", "excel/多列表.xlsx", response); } 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 a0044630d..adb7f6f0b 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 @@ -2,7 +2,6 @@ package com.ruoyi.demo.controller; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.utils.MessageUtils; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.Data; import org.hibernate.validator.constraints.Range; @@ -21,7 +20,7 @@ import javax.validation.constraints.NotNull; * @author Lion Li */ @Validated -@Tag(name ="测试国际化控制器", description = "测试国际化管理") +@Tag(name = "测试国际化控制器", description = "测试国际化管理") @RestController @RequestMapping("/demo/i18n") public class TestI18nController { @@ -31,9 +30,11 @@ public class TestI18nController { * code为 messages.properties 中的 key *

* 测试使用 user.register.success + * + * @param code 国际化code */ @GetMapping() - public R get(@Parameter(name = "国际化code") String code) { + public R get(String code) { return R.ok(MessageUtils.message(code)); } diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestSensitiveController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestSensitiveController.java index 9b7f34aaa..53a56d88b 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestSensitiveController.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestSensitiveController.java @@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController; * @version 3.6.0 * @see com.ruoyi.common.core.service.SensitiveService */ -@Tag(name ="测试数据脱敏控制器", description = "测试数据脱敏管理") +@Tag(name = "测试数据脱敏控制器", description = "测试数据脱敏管理") @RestController @RequestMapping("/demo/sensitive") public class TestSensitiveController extends BaseController { 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 c6bad6774..38e314b6b 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 @@ -13,7 +13,6 @@ import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.demo.domain.bo.TestTreeBo; import com.ruoyi.demo.domain.vo.TestTreeVo; import com.ruoyi.demo.service.ITestTreeService; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; @@ -32,7 +31,7 @@ import java.util.List; * @date 2021-07-26 */ @Validated -@Tag(name ="测试树表控制器", description = "测试树表管理") +@Tag(name = "测试树表控制器", description = "测试树表管理") @RequiredArgsConstructor @RestController @RequestMapping("/demo/tree") @@ -63,12 +62,13 @@ public class TestTreeController extends BaseController { /** * 获取测试树表详细信息 + * + * @param id 测试树ID */ @SaCheckPermission("demo:tree:query") @GetMapping("/{id}") - public R getInfo(@Parameter(name = "测试树ID") - @NotNull(message = "主键不能为空") - @PathVariable("id") Long id) { + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable("id") Long id) { return R.ok(iTestTreeService.queryById(id)); } @@ -96,13 +96,14 @@ public class TestTreeController extends BaseController { /** * 删除测试树表 + * + * @param ids 测试树ID串 */ @SaCheckPermission("demo:tree:remove") @Log(title = "测试树表", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") - public R remove(@Parameter(name = "测试树ID串") - @NotEmpty(message = "主键不能为空") - @PathVariable Long[] ids) { + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] ids) { return toAjax(iTestTreeService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0); } } diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/queue/BoundedQueueController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/queue/BoundedQueueController.java index a940c2ccf..6f921f55a 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/queue/BoundedQueueController.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/queue/BoundedQueueController.java @@ -2,7 +2,6 @@ package com.ruoyi.demo.controller.queue; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.utils.redis.QueueUtils; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -22,16 +21,21 @@ import org.springframework.web.bind.annotation.RestController; * @version 3.6.0 */ @Slf4j -@Tag(name ="有界队列 演示案例", description = "有界队列") +@Tag(name = "有界队列 演示案例", description = "有界队列") @RequiredArgsConstructor @RestController @RequestMapping("/demo/queue/bounded") public class BoundedQueueController { + /** + * 添加队列数据 + * + * @param queueName 队列名 + * @param capacity 容量 + */ @GetMapping("/add") - public R add(@Parameter(name = "队列名") String queueName, - @Parameter(name = "容量") int capacity) { + public R add(String queueName, int capacity) { // 用完了一定要销毁 否则会一直存在 boolean b = QueueUtils.destroyBoundedQueueObject(queueName); log.info("通道: {} , 删除: {}", queueName, b); @@ -54,8 +58,13 @@ public class BoundedQueueController { return R.ok("操作成功"); } + /** + * 删除队列数据 + * + * @param queueName 队列名 + */ @GetMapping("/remove") - public R remove(@Parameter(name = "队列名") String queueName) { + public R remove(String queueName) { String data = "data-" + 5; if (QueueUtils.removeBoundedQueueObject(queueName, data)) { log.info("通道: {} , 删除数据: {}", queueName, data); @@ -65,8 +74,13 @@ public class BoundedQueueController { return R.ok("操作成功"); } + /** + * 获取队列数据 + * + * @param queueName 队列名 + */ @GetMapping("/get") - public R get(@Parameter(name = "队列名") String queueName) { + public R get(String queueName) { String data; do { data = QueueUtils.getBoundedQueueObject(queueName); diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/queue/DelayedQueueController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/queue/DelayedQueueController.java index 0abcc4bea..32067e530 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/queue/DelayedQueueController.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/queue/DelayedQueueController.java @@ -2,7 +2,6 @@ package com.ruoyi.demo.controller.queue; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.utils.redis.QueueUtils; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -25,14 +24,19 @@ import java.util.concurrent.TimeUnit; * @version 3.6.0 */ @Slf4j -@Tag(name ="延迟队列 演示案例", description = "延迟队列") +@Tag(name = "延迟队列 演示案例", description = "延迟队列") @RequiredArgsConstructor @RestController @RequestMapping("/demo/queue/delayed") public class DelayedQueueController { + /** + * 订阅队列 + * + * @param queueName 队列名 + */ @GetMapping("/subscribe") - public R subscribe(@Parameter(name = "队列名") String queueName) { + public R subscribe(String queueName) { log.info("通道: {} 监听中......", queueName); // 项目初始化设置一次即可 QueueUtils.subscribeBlockingQueue(queueName, (String orderNum) -> { @@ -42,19 +46,29 @@ public class DelayedQueueController { return R.ok("操作成功"); } + /** + * 添加队列数据 + * + * @param queueName 队列名 + * @param orderNum 订单号 + * @param time 延迟时间(秒) + */ @GetMapping("/add") - public R add(@Parameter(name = "队列名") String queueName, - @Parameter(name = "订单号") String orderNum, - @Parameter(name = "延迟时间(秒)") Long time) { + public R add(String queueName, String orderNum, Long time) { QueueUtils.addDelayedQueueObject(queueName, orderNum, time, TimeUnit.SECONDS); // 观察发送时间 log.info("通道: {} , 发送数据: {}", queueName, orderNum); return R.ok("操作成功"); } + /** + * 删除队列数据 + * + * @param queueName 队列名 + * @param orderNum 订单号 + */ @GetMapping("/remove") - public R remove(@Parameter(name = "队列名") String queueName, - @Parameter(name = "订单号") String orderNum) { + public R remove(String queueName, String orderNum) { if (QueueUtils.removeDelayedQueueObject(queueName, orderNum)) { log.info("通道: {} , 删除数据: {}", queueName, orderNum); } else { @@ -63,8 +77,13 @@ public class DelayedQueueController { return R.ok("操作成功"); } + /** + * 销毁队列 + * + * @param queueName 队列名 + */ @GetMapping("/destroy") - public R destroy(@Parameter(name = "队列名") String queueName) { + public R destroy(String queueName) { // 用完了一定要销毁 否则会一直存在 QueueUtils.destroyDelayedQueue(queueName); return R.ok("操作成功"); diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/queue/PriorityQueueController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/queue/PriorityQueueController.java index 1651631f1..1e7425f49 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/queue/PriorityQueueController.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/queue/PriorityQueueController.java @@ -3,7 +3,6 @@ package com.ruoyi.demo.controller.queue; import cn.hutool.core.util.RandomUtil; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.utils.redis.QueueUtils; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -23,14 +22,19 @@ import org.springframework.web.bind.annotation.RestController; * @version 3.6.0 */ @Slf4j -@Tag(name ="优先队列 演示案例", description = "优先队列") +@Tag(name = "优先队列 演示案例", description = "优先队列") @RequiredArgsConstructor @RestController @RequestMapping("/demo/queue/priority") public class PriorityQueueController { + /** + * 添加队列数据 + * + * @param queueName 队列名 + */ @GetMapping("/add") - public R add(@Parameter(name = "队列名") String queueName) { + public R add(String queueName) { // 用完了一定要销毁 否则会一直存在 boolean b = QueueUtils.destroyPriorityQueueObject(queueName); log.info("通道: {} , 删除: {}", queueName, b); @@ -56,10 +60,15 @@ public class PriorityQueueController { return R.ok("操作成功"); } + /** + * 删除队列数据 + * + * @param queueName 队列名 + * @param name 对象名 + * @param orderNum 排序号 + */ @GetMapping("/remove") - public R remove(@Parameter(name = "队列名") String queueName, - @Parameter(name = "对象名") String name, - @Parameter(name = "排序号") Integer orderNum) { + public R remove(String queueName, String name, Integer orderNum) { PriorityDemo data = new PriorityDemo(); data.setName(name); data.setOrderNum(orderNum); @@ -71,8 +80,13 @@ public class PriorityQueueController { return R.ok("操作成功"); } + /** + * 获取队列数据 + * + * @param queueName 队列名 + */ @GetMapping("/get") - public R get(@Parameter(name = "队列名") String queueName) { + public R get(String queueName) { PriorityDemo data; do { data = QueueUtils.getPriorityQueueObject(queueName); diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java index c677378a0..271f01ff3 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java @@ -3,6 +3,7 @@ package com.ruoyi.framework.config; import com.ruoyi.framework.config.properties.SwaggerProperties; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.security.SecurityRequirement; import lombok.RequiredArgsConstructor; import org.springdoc.core.SpringDocConfiguration; import org.springframework.boot.autoconfigure.AutoConfigureBefore; @@ -11,6 +12,9 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import java.util.ArrayList; +import java.util.List; + /** * Swagger 文档配置 * @@ -37,6 +41,9 @@ public class SwaggerConfig { openApi.tags(swaggerProperties.getTags()); openApi.paths(swaggerProperties.getPaths()); openApi.components(swaggerProperties.getComponents()); + List list = new ArrayList<>(); + list.add(new SecurityRequirement().addList("apikey")); + openApi.security(list); return openApi; } diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java index d8c405e11..7a20df1ad 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/controller/GenController.java @@ -48,6 +48,8 @@ public class GenController extends BaseController { /** * 修改代码生成业务 + * + * @param tableId 表ID */ @SaCheckPermission("tool:gen:query") @GetMapping(value = "/{tableId}") @@ -73,6 +75,8 @@ public class GenController extends BaseController { /** * 查询数据表字段列表 + * + * @param tableId 表ID */ @SaCheckPermission("tool:gen:list") @GetMapping(value = "/column/{tableId}") @@ -86,6 +90,8 @@ public class GenController extends BaseController { /** * 导入表结构(保存) + * + * @param tables 表名串 */ @SaCheckPermission("tool:gen:import") @Log(title = "代码生成", businessType = BusinessType.IMPORT) @@ -112,6 +118,8 @@ public class GenController extends BaseController { /** * 删除代码生成 + * + * @param tableIds 表ID串 */ @SaCheckPermission("tool:gen:remove") @Log(title = "代码生成", businessType = BusinessType.DELETE) @@ -123,6 +131,8 @@ public class GenController extends BaseController { /** * 预览代码 + * + * @param tableId 表ID */ @SaCheckPermission("tool:gen:preview") @GetMapping("/preview/{tableId}") @@ -133,6 +143,8 @@ public class GenController extends BaseController { /** * 生成代码(下载方式) + * + * @param tableName 表名 */ @SaCheckPermission("tool:gen:code") @Log(title = "代码生成", businessType = BusinessType.GENCODE) @@ -144,6 +156,8 @@ public class GenController extends BaseController { /** * 生成代码(自定义路径) + * + * @param tableName 表名 */ @SaCheckPermission("tool:gen:code") @Log(title = "代码生成", businessType = BusinessType.GENCODE) @@ -155,6 +169,8 @@ public class GenController extends BaseController { /** * 同步数据库 + * + * @param tableName 表名 */ @SaCheckPermission("tool:gen:edit") @Log(title = "代码生成", businessType = BusinessType.UPDATE) @@ -166,6 +182,8 @@ public class GenController extends BaseController { /** * 批量生成代码 + * + * @param tables 表名串 */ @SaCheckPermission("tool:gen:code") @Log(title = "代码生成", businessType = BusinessType.GENCODE) 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 5b307640b..550be928a 100644 --- a/ruoyi-generator/src/main/resources/vm/java/controller.java.vm +++ b/ruoyi-generator/src/main/resources/vm/java/controller.java.vm @@ -73,12 +73,13 @@ public class ${ClassName}Controller extends BaseController { /** * 获取${functionName}详细信息 + * + * @param ${pkColumn.javaField} 主键 */ @SaCheckPermission("${permissionPrefix}:query") @GetMapping("/{${pkColumn.javaField}}") - public R<${ClassName}Vo> getInfo(@Parameter(name = "主键") - @NotNull(message = "主键不能为空") - @PathVariable("${pkColumn.javaField}") ${pkColumn.javaType} ${pkColumn.javaField}) { + public R<${ClassName}Vo> getInfo(@NotNull(message = "主键不能为空") + @PathVariable ${pkColumn.javaType} ${pkColumn.javaField}) { return R.ok(i${ClassName}Service.queryById(${pkColumn.javaField})); } @@ -106,13 +107,14 @@ public class ${ClassName}Controller extends BaseController { /** * 删除${functionName} + * + * @param ${pkColumn.javaField}s 主键串 */ @SaCheckPermission("${permissionPrefix}:remove") @Log(title = "${functionName}", businessType = BusinessType.DELETE) @DeleteMapping("/{${pkColumn.javaField}s}") - public R remove(@Parameter(name = "主键串") - @NotEmpty(message = "主键不能为空") - @PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) { + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) { return toAjax(i${ClassName}Service.deleteWithValidByIds(Arrays.asList(${pkColumn.javaField}s), true) ? 1 : 0); } }