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);
}
}