diff --git a/haiwei-admin/src/main/java/com/haiwei/web/core/config/SwaggerConfig.java b/haiwei-admin/src/main/java/com/haiwei/web/core/config/SwaggerConfig.java index 20b4ab4..2cd4d28 100644 --- a/haiwei-admin/src/main/java/com/haiwei/web/core/config/SwaggerConfig.java +++ b/haiwei-admin/src/main/java/com/haiwei/web/core/config/SwaggerConfig.java @@ -1,6 +1,7 @@ package com.haiwei.web.core.config; import com.google.common.collect.Ordering; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -19,23 +20,23 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; /** * Swagger2的接口配置 - * + * * @author ruoyi */ @Configuration @EnableSwagger2 -public class SwaggerConfig -{ - /** 是否开启swagger */ +public class SwaggerConfig { + /** + * 是否开启swagger + */ @Value("${swagger.enabled}") private boolean enabled; - + /** * 创建API */ @Bean - public Docket createRestApi() - { + public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) // 是否启用Swagger .enable(enabled) @@ -44,10 +45,11 @@ public class SwaggerConfig // 设置哪些接口暴露给Swagger展示 .select() // 扫描所有有注解的api,用这种方式更灵活 -// .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) // 扫描指定包中的swagger注解 - .apis(RequestHandlerSelectors.basePackage("com.haiwei.web.controller.broad")) - // 扫描所有 .apis(RequestHandlerSelectors.any()) +// .apis(RequestHandlerSelectors.basePackage("com.haiwei.web.controller.broad")) +// 扫描所有 +// .apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any()) .build() // .operationOrdering(new Ordering() { @@ -65,11 +67,11 @@ public class SwaggerConfig // .operationsSorter(OperationsSorter.ALPHA) // .build(); // } + /** * 添加摘要信息 */ - private ApiInfo apiInfo() - { + private ApiInfo apiInfo() { // 用ApiInfoBuilder进行定制 return new ApiInfoBuilder() // 设置标题 diff --git a/haiwei-manage/src/main/java/com/haiwei/manage/controller/BsaeFileController.java b/haiwei-manage/src/main/java/com/haiwei/manage/controller/BsaeFileController.java index 45fb148..fc721a1 100644 --- a/haiwei-manage/src/main/java/com/haiwei/manage/controller/BsaeFileController.java +++ b/haiwei-manage/src/main/java/com/haiwei/manage/controller/BsaeFileController.java @@ -3,6 +3,7 @@ package com.haiwei.manage.controller; import java.util.List; import com.haiwei.manage.service.IBaseCustomerService; +import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -48,7 +49,8 @@ public class BsaeFileController extends BaseController /** * 查询文档归档列表 */ - @RequiresPermissions("manage:base_file:list") +// @RequiresPermissions("manage:base_file:list") + @ApiOperation(tags = {"文档归档"}, value = "文件-查询") @PostMapping("/list") @ResponseBody public TableDataInfo list(BsaeFile bsaeFile) @@ -75,6 +77,7 @@ public class BsaeFileController extends BaseController /** * 新增文档归档 */ + @ApiOperation(tags = {"文档归档"}, value = "文件-添加") @GetMapping("/add") public String add(ModelMap mmap) { @@ -121,7 +124,8 @@ public class BsaeFileController extends BaseController /** * 删除文档归档 */ - @RequiresPermissions("manage:base_file:remove") +// @RequiresPermissions("manage:base_file:remove") + @ApiOperation(tags = {"文档归档"}, value = "文件删除") @Log(title = "文档归档", businessType = BusinessType.DELETE) @PostMapping( "/remove") @ResponseBody