Commit 2d93e7aeb3da856097db407952561354bc3899c8
1 parent
1a079532
swagger添加enable参数控制是否启用
Showing
3 changed files
with
12 additions
and
1 deletions
ruoyi/sql/ry_20200415.sql
| ... | ... | @@ -138,7 +138,7 @@ create table sys_menu ( |
| 138 | 138 | is_frame int(1) default 1 comment '是否为外链(0是 1否)', |
| 139 | 139 | menu_type char(1) default '' comment '菜单类型(M目录 C菜单 F按钮)', |
| 140 | 140 | visible char(1) default 0 comment '菜单状态(0显示 1隐藏)', |
| 141 | - status char(1) not null comment '菜单状态(0正常 1停用)', | |
| 141 | + status char(1) default 0 comment '菜单状态(0正常 1停用)', | |
| 142 | 142 | perms varchar(100) default null comment '权限标识', |
| 143 | 143 | icon varchar(100) default '#' comment '菜单图标', |
| 144 | 144 | create_by varchar(64) default '' comment '创建者', | ... | ... |
ruoyi/src/main/java/com/ruoyi/framework/config/SwaggerConfig.java
| ... | ... | @@ -3,6 +3,7 @@ package com.ruoyi.framework.config; |
| 3 | 3 | import java.util.ArrayList; |
| 4 | 4 | import java.util.List; |
| 5 | 5 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | +import org.springframework.beans.factory.annotation.Value; | |
| 6 | 7 | import org.springframework.context.annotation.Bean; |
| 7 | 8 | import org.springframework.context.annotation.Configuration; |
| 8 | 9 | import io.swagger.annotations.ApiOperation; |
| ... | ... | @@ -32,6 +33,10 @@ public class SwaggerConfig |
| 32 | 33 | @Autowired |
| 33 | 34 | private RuoYiConfig ruoyiConfig; |
| 34 | 35 | |
| 36 | + /** Swagger开关配置 */ | |
| 37 | + @Value("${swagger.enable}") | |
| 38 | + private boolean swaggerEnable; | |
| 39 | + | |
| 35 | 40 | /** |
| 36 | 41 | * 创建API |
| 37 | 42 | */ |
| ... | ... | @@ -39,6 +44,8 @@ public class SwaggerConfig |
| 39 | 44 | public Docket createRestApi() |
| 40 | 45 | { |
| 41 | 46 | return new Docket(DocumentationType.SWAGGER_2) |
| 47 | + // 是否启用Swagger | |
| 48 | + .enable(swaggerEnable) | |
| 42 | 49 | .pathMapping("/dev-api") |
| 43 | 50 | // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息) |
| 44 | 51 | .apiInfo(apiInfo()) | ... | ... |