From 2902a959f364191821965fa6af5a08cad106ed0d Mon Sep 17 00:00:00 2001 From: weihongyang <1075331873@qq.com> Date: Tue, 21 Jun 2022 13:39:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E7=9A=84swagger=E6=B3=A8=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cnbm/admin/config/SecurityConfig.java | 5 ++++- .../admin/controller/SysDictDataController.java | 12 ++++++------ .../admin/controller/SysDictTypeController.java | 12 ++++++------ .../admin/controller/SysLogErrorController.java | 8 ++++---- .../controller/SysLogOperationController.java | 10 +++++----- .../cnbm/admin/controller/SysMenuController.java | 2 +- .../admin/controller/SysParamsController.java | 12 ++++++------ .../cnbm/admin/controller/SysRoleController.java | 10 +++++----- .../cnbm/admin/controller/SysUserController.java | 16 ++++++++-------- .../src/main/java/com/cnbm/AdminApplication.java | 3 ++- 10 files changed, 47 insertions(+), 43 deletions(-) diff --git a/ym-admin/src/main/java/com/cnbm/admin/config/SecurityConfig.java b/ym-admin/src/main/java/com/cnbm/admin/config/SecurityConfig.java index 3c66bed..01bb30f 100644 --- a/ym-admin/src/main/java/com/cnbm/admin/config/SecurityConfig.java +++ b/ym-admin/src/main/java/com/cnbm/admin/config/SecurityConfig.java @@ -48,7 +48,10 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { .and() .authorizeRequests() // 对于登录接口 允许匿名访问 - .antMatchers("/login").anonymous() + .antMatchers("/login","/swagger/**","/v2/api-docs", + "/doc.html", + "/swagger-resources/**", + "/swagger-ui/**").anonymous() // .antMatchers("/testCors").hasAuthority("system:dept:list222") // 除上面外的所有请求全部需要鉴权认证 .anyRequest().authenticated(); diff --git a/ym-admin/src/main/java/com/cnbm/admin/controller/SysDictDataController.java b/ym-admin/src/main/java/com/cnbm/admin/controller/SysDictDataController.java index 3f799cd..982d63d 100644 --- a/ym-admin/src/main/java/com/cnbm/admin/controller/SysDictDataController.java +++ b/ym-admin/src/main/java/com/cnbm/admin/controller/SysDictDataController.java @@ -36,12 +36,12 @@ public class SysDictDataController { @GetMapping("page") @ApiOperation("字典数据") @ApiImplicitParams({ - @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , - @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , - @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , - @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") , - @ApiImplicitParam(name = "dictLabel", value = "字典标签", paramType = "query", dataType="String"), - @ApiImplicitParam(name = "dictValue", value = "字典值", paramType = "query", dataType="String") + @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataTypeClass=Integer.class) , + @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) , + @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) , + @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class) , + @ApiImplicitParam(name = "dictLabel", value = "字典标签", paramType = "query", dataTypeClass=String.class), + @ApiImplicitParam(name = "dictValue", value = "字典值", paramType = "query", dataTypeClass=String.class) }) @PreAuthorize("@ex.hasAuthority('sys:dept:page')") public Result> page(@ApiIgnore @RequestParam Map params){ diff --git a/ym-admin/src/main/java/com/cnbm/admin/controller/SysDictTypeController.java b/ym-admin/src/main/java/com/cnbm/admin/controller/SysDictTypeController.java index 222fcff..0a547ea 100644 --- a/ym-admin/src/main/java/com/cnbm/admin/controller/SysDictTypeController.java +++ b/ym-admin/src/main/java/com/cnbm/admin/controller/SysDictTypeController.java @@ -38,12 +38,12 @@ public class SysDictTypeController { @GetMapping("page") @ApiOperation("字典类型") @ApiImplicitParams({ - @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , - @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , - @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , - @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") , - @ApiImplicitParam(name = "dictType", value = "字典类型", paramType = "query", dataType="String"), - @ApiImplicitParam(name = "dictName", value = "字典名称", paramType = "query", dataType="String") + @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataTypeClass=Integer.class) , + @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) , + @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) , + @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class) , + @ApiImplicitParam(name = "dictType", value = "字典类型", paramType = "query", dataTypeClass=String.class), + @ApiImplicitParam(name = "dictName", value = "字典名称", paramType = "query", dataTypeClass=String.class) }) @PreAuthorize("@ex.hasAuthority('sys:dict:page')") public Result> page(@ApiIgnore @RequestParam Map params){ diff --git a/ym-admin/src/main/java/com/cnbm/admin/controller/SysLogErrorController.java b/ym-admin/src/main/java/com/cnbm/admin/controller/SysLogErrorController.java index 6aef1ec..21c7e7e 100644 --- a/ym-admin/src/main/java/com/cnbm/admin/controller/SysLogErrorController.java +++ b/ym-admin/src/main/java/com/cnbm/admin/controller/SysLogErrorController.java @@ -38,10 +38,10 @@ public class SysLogErrorController { @GetMapping("page") @ApiOperation("分页") @ApiImplicitParams({ - @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , - @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , - @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , - @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") + @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataTypeClass=Integer.class) , + @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) , + @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) , + @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class) }) public Result> page(@ApiIgnore @RequestParam Map params){ PageData page = sysLogErrorService.page(params); diff --git a/ym-admin/src/main/java/com/cnbm/admin/controller/SysLogOperationController.java b/ym-admin/src/main/java/com/cnbm/admin/controller/SysLogOperationController.java index 6034d18..f571fee 100644 --- a/ym-admin/src/main/java/com/cnbm/admin/controller/SysLogOperationController.java +++ b/ym-admin/src/main/java/com/cnbm/admin/controller/SysLogOperationController.java @@ -38,11 +38,11 @@ public class SysLogOperationController { @GetMapping("page") @ApiOperation("分页") @ApiImplicitParams({ - @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , - @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , - @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , - @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") , - @ApiImplicitParam(name = "status", value = "状态 0:失败 1:成功", paramType = "query", dataType="int") + @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataTypeClass=Integer.class) , + @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) , + @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) , + @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class) , + @ApiImplicitParam(name = "status", value = "状态 0:失败 1:成功", paramType = "query", dataTypeClass=String.class) }) public Result> page(@ApiIgnore @RequestParam Map params){ PageData page = sysLogOperationService.page(params); diff --git a/ym-admin/src/main/java/com/cnbm/admin/controller/SysMenuController.java b/ym-admin/src/main/java/com/cnbm/admin/controller/SysMenuController.java index dcea161..61f88b3 100644 --- a/ym-admin/src/main/java/com/cnbm/admin/controller/SysMenuController.java +++ b/ym-admin/src/main/java/com/cnbm/admin/controller/SysMenuController.java @@ -60,7 +60,7 @@ public class SysMenuController { @GetMapping("list") @ApiOperation("列表") - @ApiImplicitParam(name = "type", value = "菜单类型 0:菜单 1:按钮 null:全部", paramType = "query", dataType="int") + @ApiImplicitParam(name = "type", value = "菜单类型 0:菜单 1:按钮 null:全部", paramType = "query", dataTypeClass=Integer.class) @PreAuthorize("@ex.hasAuthority('sys:menu:list')") public Result> list(Integer type){ List list = sysMenuService.getAllMenuList(type); diff --git a/ym-admin/src/main/java/com/cnbm/admin/controller/SysParamsController.java b/ym-admin/src/main/java/com/cnbm/admin/controller/SysParamsController.java index cfa9adb..68af592 100644 --- a/ym-admin/src/main/java/com/cnbm/admin/controller/SysParamsController.java +++ b/ym-admin/src/main/java/com/cnbm/admin/controller/SysParamsController.java @@ -41,11 +41,11 @@ public class SysParamsController { @GetMapping("page") @ApiOperation("分页") @ApiImplicitParams({ - @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , - @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , - @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , - @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") , - @ApiImplicitParam(name = "paramCode", value = "参数编码", paramType = "query", dataType="String") + @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataTypeClass=Integer.class) , + @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) , + @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) , + @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class) , + @ApiImplicitParam(name = "paramCode", value = "参数编码", paramType = "query", dataTypeClass=String.class) }) @PreAuthorize("@ex.hasAuthority('sys:params:page')") public Result> page(@ApiIgnore @RequestParam Map params){ @@ -105,7 +105,7 @@ public class SysParamsController { @GetMapping("export") @ApiOperation("导出") @LogOperation("导出") - @ApiImplicitParam(name = "paramCode", value = "参数编码", paramType = "query", dataType="String") + @ApiImplicitParam(name = "paramCode", value = "参数编码", paramType = "query", dataTypeClass=String.class) @PreAuthorize("@ex.hasAuthority('sys:params:export')") public void export(@ApiIgnore @RequestParam Map params, HttpServletResponse response) throws Exception { List list = sysParamsService.list(params); diff --git a/ym-admin/src/main/java/com/cnbm/admin/controller/SysRoleController.java b/ym-admin/src/main/java/com/cnbm/admin/controller/SysRoleController.java index 5e87715..1ac3763 100644 --- a/ym-admin/src/main/java/com/cnbm/admin/controller/SysRoleController.java +++ b/ym-admin/src/main/java/com/cnbm/admin/controller/SysRoleController.java @@ -45,11 +45,11 @@ public class SysRoleController { @GetMapping("page") @ApiOperation("分页") @ApiImplicitParams({ - @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , - @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , - @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , - @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") , - @ApiImplicitParam(name = "name", value = "角色名", paramType = "query", dataType="String") + @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataTypeClass=Integer.class) , + @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) , + @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) , + @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class) , + @ApiImplicitParam(name = "name", value = "角色名", paramType = "query", dataTypeClass=String.class) }) @PreAuthorize("@ex.hasAuthority('sys:role:page')") public Result> page(@ApiIgnore @RequestParam Map params){ diff --git a/ym-admin/src/main/java/com/cnbm/admin/controller/SysUserController.java b/ym-admin/src/main/java/com/cnbm/admin/controller/SysUserController.java index 8bf9bc1..7e93314 100644 --- a/ym-admin/src/main/java/com/cnbm/admin/controller/SysUserController.java +++ b/ym-admin/src/main/java/com/cnbm/admin/controller/SysUserController.java @@ -53,13 +53,13 @@ public class SysUserController { @GetMapping("page") @ApiOperation("分页") @ApiImplicitParams({ - @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , - @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , - @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , - @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") , - @ApiImplicitParam(name = "username", value = "用户名", paramType = "query", dataType="String"), - @ApiImplicitParam(name = "gender", value = "性别", paramType = "query", dataType="String"), - @ApiImplicitParam(name = "deptId", value = "部门ID", paramType = "query", dataType="String") + @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataTypeClass=Integer.class) , + @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) , + @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) , + @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class) , + @ApiImplicitParam(name = "username", value = "用户名", paramType = "query", dataTypeClass=String.class), + @ApiImplicitParam(name = "gender", value = "性别", paramType = "query", dataTypeClass=String.class), + @ApiImplicitParam(name = "deptId", value = "部门ID", paramType = "query", dataTypeClass=String.class) }) @PreAuthorize("@ex.hasAuthority('sys:user:page')") public Result> page(@ApiIgnore @RequestParam Map params){ @@ -153,7 +153,7 @@ public class SysUserController { @GetMapping("export") @ApiOperation("导出") @LogOperation("导出") - @ApiImplicitParam(name = "username", value = "用户名", paramType = "query", dataType="String") + @ApiImplicitParam(name = "username", value = "用户名", paramType = "query", dataTypeClass=String.class) @PreAuthorize("@ex.hasAuthority('sys:user:export')") public void export(@ApiIgnore @RequestParam Map params, HttpServletResponse response) throws Exception { List list = sysUserService.list(params); diff --git a/ym-gateway/src/main/java/com/cnbm/AdminApplication.java b/ym-gateway/src/main/java/com/cnbm/AdminApplication.java index afa4a80..5c142b6 100644 --- a/ym-gateway/src/main/java/com/cnbm/AdminApplication.java +++ b/ym-gateway/src/main/java/com/cnbm/AdminApplication.java @@ -2,6 +2,7 @@ package com.cnbm; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import springfox.documentation.oas.annotations.EnableOpenApi; /** * @Author weihongyang @@ -9,7 +10,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; * @Version 1.0 */ @SpringBootApplication - +@EnableOpenApi public class AdminApplication { public static void main(String[] args) { SpringApplication.run(AdminApplication.class,args);