From 2d93e7aeb3da856097db407952561354bc3899c8 Mon Sep 17 00:00:00 2001 From: RuoYi Date: Wed, 29 Apr 2020 21:58:24 +0800 Subject: [PATCH] =?UTF-8?q?swagger=E6=B7=BB=E5=8A=A0enable=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E6=8E=A7=E5=88=B6=E6=98=AF=E5=90=A6=E5=90=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi/sql/ry_20200415.sql | 2 +- .../java/com/ruoyi/framework/config/SwaggerConfig.java | 7 +++++++ ruoyi/src/main/resources/application.yml | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ruoyi/sql/ry_20200415.sql b/ruoyi/sql/ry_20200415.sql index 8663aad8a..cf5124726 100644 --- a/ruoyi/sql/ry_20200415.sql +++ b/ruoyi/sql/ry_20200415.sql @@ -138,7 +138,7 @@ create table sys_menu ( is_frame int(1) default 1 comment '是否为外链(0是 1否)', menu_type char(1) default '' comment '菜单类型(M目录 C菜单 F按钮)', visible char(1) default 0 comment '菜单状态(0显示 1隐藏)', - status char(1) not null comment '菜单状态(0正常 1停用)', + status char(1) default 0 comment '菜单状态(0正常 1停用)', perms varchar(100) default null comment '权限标识', icon varchar(100) default '#' comment '菜单图标', create_by varchar(64) default '' comment '创建者', diff --git a/ruoyi/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java b/ruoyi/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java index a51cd34f6..74786d9ed 100644 --- a/ruoyi/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java +++ b/ruoyi/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java @@ -3,6 +3,7 @@ package com.ruoyi.framework.config; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import io.swagger.annotations.ApiOperation; @@ -32,6 +33,10 @@ public class SwaggerConfig @Autowired private RuoYiConfig ruoyiConfig; + /** Swagger开关配置 */ + @Value("${swagger.enable}") + private boolean swaggerEnable; + /** * 创建API */ @@ -39,6 +44,8 @@ public class SwaggerConfig public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) + // 是否启用Swagger + .enable(swaggerEnable) .pathMapping("/dev-api") // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息) .apiInfo(apiInfo()) diff --git a/ruoyi/src/main/resources/application.yml b/ruoyi/src/main/resources/application.yml index 8658f879e..34b1f4324 100644 --- a/ruoyi/src/main/resources/application.yml +++ b/ruoyi/src/main/resources/application.yml @@ -100,6 +100,10 @@ pagehelper: supportMethodsArguments: true params: count=countSql +# Swagger配置 +swagger: + enable: true + # 防止XSS攻击 xss: # 过滤开关