fix: 修改请求接口的swagger注解
This commit is contained in:
		| @@ -48,7 +48,10 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { | |||||||
|                 .and() |                 .and() | ||||||
|                 .authorizeRequests() |                 .authorizeRequests() | ||||||
|                 // 对于登录接口 允许匿名访问 |                 // 对于登录接口 允许匿名访问 | ||||||
|                 .antMatchers("/login").anonymous() |                 .antMatchers("/login","/swagger/**","/v2/api-docs", | ||||||
|  |                         "/doc.html", | ||||||
|  |                         "/swagger-resources/**", | ||||||
|  |                         "/swagger-ui/**").anonymous() | ||||||
| //                .antMatchers("/testCors").hasAuthority("system:dept:list222") | //                .antMatchers("/testCors").hasAuthority("system:dept:list222") | ||||||
|                 // 除上面外的所有请求全部需要鉴权认证 |                 // 除上面外的所有请求全部需要鉴权认证 | ||||||
|                 .anyRequest().authenticated(); |                 .anyRequest().authenticated(); | ||||||
|   | |||||||
| @@ -36,12 +36,12 @@ public class SysDictDataController { | |||||||
|     @GetMapping("page") |     @GetMapping("page") | ||||||
|     @ApiOperation("字典数据") |     @ApiOperation("字典数据") | ||||||
|     @ApiImplicitParams({ |     @ApiImplicitParams({ | ||||||
|             @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , |             @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataTypeClass=Integer.class) , | ||||||
|             @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , |             @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) , | ||||||
|             @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , |             @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) , | ||||||
|             @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") , |             @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class) , | ||||||
|             @ApiImplicitParam(name = "dictLabel", value = "字典标签", paramType = "query", dataType="String"), |             @ApiImplicitParam(name = "dictLabel", value = "字典标签", paramType = "query", dataTypeClass=String.class), | ||||||
|             @ApiImplicitParam(name = "dictValue", value = "字典值", paramType = "query", dataType="String") |             @ApiImplicitParam(name = "dictValue", value = "字典值", paramType = "query", dataTypeClass=String.class) | ||||||
|     }) |     }) | ||||||
|     @PreAuthorize("@ex.hasAuthority('sys:dept:page')") |     @PreAuthorize("@ex.hasAuthority('sys:dept:page')") | ||||||
|     public Result<PageData<SysDictDataDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ |     public Result<PageData<SysDictDataDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ | ||||||
|   | |||||||
| @@ -38,12 +38,12 @@ public class SysDictTypeController { | |||||||
|     @GetMapping("page") |     @GetMapping("page") | ||||||
|     @ApiOperation("字典类型") |     @ApiOperation("字典类型") | ||||||
|     @ApiImplicitParams({ |     @ApiImplicitParams({ | ||||||
|             @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , |             @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataTypeClass=Integer.class) , | ||||||
|             @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , |             @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) , | ||||||
|             @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , |             @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) , | ||||||
|             @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") , |             @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class) , | ||||||
|             @ApiImplicitParam(name = "dictType", value = "字典类型", paramType = "query", dataType="String"), |             @ApiImplicitParam(name = "dictType", value = "字典类型", paramType = "query", dataTypeClass=String.class), | ||||||
|             @ApiImplicitParam(name = "dictName", value = "字典名称", paramType = "query", dataType="String") |             @ApiImplicitParam(name = "dictName", value = "字典名称", paramType = "query", dataTypeClass=String.class) | ||||||
|     }) |     }) | ||||||
|     @PreAuthorize("@ex.hasAuthority('sys:dict:page')") |     @PreAuthorize("@ex.hasAuthority('sys:dict:page')") | ||||||
|     public Result<PageData<SysDictTypeDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ |     public Result<PageData<SysDictTypeDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ | ||||||
|   | |||||||
| @@ -38,10 +38,10 @@ public class SysLogErrorController { | |||||||
|     @GetMapping("page") |     @GetMapping("page") | ||||||
|     @ApiOperation("分页") |     @ApiOperation("分页") | ||||||
|     @ApiImplicitParams({ |     @ApiImplicitParams({ | ||||||
|             @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , |             @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataTypeClass=Integer.class) , | ||||||
|             @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , |             @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) , | ||||||
|             @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , |             @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) , | ||||||
|             @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") |             @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class) | ||||||
|     }) |     }) | ||||||
|     public Result<PageData<SysLogErrorDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ |     public Result<PageData<SysLogErrorDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ | ||||||
|         PageData<SysLogErrorDTO> page = sysLogErrorService.page(params); |         PageData<SysLogErrorDTO> page = sysLogErrorService.page(params); | ||||||
|   | |||||||
| @@ -38,11 +38,11 @@ public class SysLogOperationController { | |||||||
|     @GetMapping("page") |     @GetMapping("page") | ||||||
|     @ApiOperation("分页") |     @ApiOperation("分页") | ||||||
|     @ApiImplicitParams({ |     @ApiImplicitParams({ | ||||||
|             @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , |             @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataTypeClass=Integer.class) , | ||||||
|             @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , |             @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) , | ||||||
|             @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , |             @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) , | ||||||
|             @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") , |             @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class) , | ||||||
|             @ApiImplicitParam(name = "status", value = "状态  0:失败    1:成功", paramType = "query", dataType="int") |             @ApiImplicitParam(name = "status", value = "状态  0:失败    1:成功", paramType = "query", dataTypeClass=String.class) | ||||||
|     }) |     }) | ||||||
|     public Result<PageData<SysLogOperationDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ |     public Result<PageData<SysLogOperationDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ | ||||||
|         PageData<SysLogOperationDTO> page = sysLogOperationService.page(params); |         PageData<SysLogOperationDTO> page = sysLogOperationService.page(params); | ||||||
|   | |||||||
| @@ -60,7 +60,7 @@ public class SysMenuController { | |||||||
|  |  | ||||||
|     @GetMapping("list") |     @GetMapping("list") | ||||||
|     @ApiOperation("列表") |     @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')") |     @PreAuthorize("@ex.hasAuthority('sys:menu:list')") | ||||||
|     public Result<List<SysMenuDTO>> list(Integer type){ |     public Result<List<SysMenuDTO>> list(Integer type){ | ||||||
|         List<SysMenuDTO> list = sysMenuService.getAllMenuList(type); |         List<SysMenuDTO> list = sysMenuService.getAllMenuList(type); | ||||||
|   | |||||||
| @@ -41,11 +41,11 @@ public class SysParamsController { | |||||||
|     @GetMapping("page") |     @GetMapping("page") | ||||||
|     @ApiOperation("分页") |     @ApiOperation("分页") | ||||||
|     @ApiImplicitParams({ |     @ApiImplicitParams({ | ||||||
|             @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , |             @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataTypeClass=Integer.class) , | ||||||
|             @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , |             @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) , | ||||||
|             @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , |             @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) , | ||||||
|             @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") , |             @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class) , | ||||||
|             @ApiImplicitParam(name = "paramCode", value = "参数编码", paramType = "query", dataType="String") |             @ApiImplicitParam(name = "paramCode", value = "参数编码", paramType = "query", dataTypeClass=String.class) | ||||||
|     }) |     }) | ||||||
|     @PreAuthorize("@ex.hasAuthority('sys:params:page')") |     @PreAuthorize("@ex.hasAuthority('sys:params:page')") | ||||||
|     public Result<PageData<SysParamsDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ |     public Result<PageData<SysParamsDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ | ||||||
| @@ -105,7 +105,7 @@ public class SysParamsController { | |||||||
|     @GetMapping("export") |     @GetMapping("export") | ||||||
|     @ApiOperation("导出") |     @ApiOperation("导出") | ||||||
|     @LogOperation("导出") |     @LogOperation("导出") | ||||||
|     @ApiImplicitParam(name = "paramCode", value = "参数编码", paramType = "query", dataType="String") |     @ApiImplicitParam(name = "paramCode", value = "参数编码", paramType = "query", dataTypeClass=String.class) | ||||||
|     @PreAuthorize("@ex.hasAuthority('sys:params:export')") |     @PreAuthorize("@ex.hasAuthority('sys:params:export')") | ||||||
|     public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |     public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { | ||||||
|         List<SysParamsDTO> list = sysParamsService.list(params); |         List<SysParamsDTO> list = sysParamsService.list(params); | ||||||
|   | |||||||
| @@ -45,11 +45,11 @@ public class SysRoleController { | |||||||
|     @GetMapping("page") |     @GetMapping("page") | ||||||
|     @ApiOperation("分页") |     @ApiOperation("分页") | ||||||
|     @ApiImplicitParams({ |     @ApiImplicitParams({ | ||||||
|             @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , |             @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataTypeClass=Integer.class) , | ||||||
|             @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , |             @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) , | ||||||
|             @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , |             @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) , | ||||||
|             @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") , |             @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class) , | ||||||
|             @ApiImplicitParam(name = "name", value = "角色名", paramType = "query", dataType="String") |             @ApiImplicitParam(name = "name", value = "角色名", paramType = "query", dataTypeClass=String.class) | ||||||
|     }) |     }) | ||||||
|     @PreAuthorize("@ex.hasAuthority('sys:role:page')") |     @PreAuthorize("@ex.hasAuthority('sys:role:page')") | ||||||
|     public Result<PageData<SysRoleDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ |     public Result<PageData<SysRoleDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ | ||||||
|   | |||||||
| @@ -53,13 +53,13 @@ public class SysUserController { | |||||||
|     @GetMapping("page") |     @GetMapping("page") | ||||||
|     @ApiOperation("分页") |     @ApiOperation("分页") | ||||||
|     @ApiImplicitParams({ |     @ApiImplicitParams({ | ||||||
|             @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") , |             @ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataTypeClass=Integer.class) , | ||||||
|             @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") , |             @ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) , | ||||||
|             @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") , |             @ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) , | ||||||
|             @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") , |             @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class) , | ||||||
|             @ApiImplicitParam(name = "username", value = "用户名", paramType = "query", dataType="String"), |             @ApiImplicitParam(name = "username", value = "用户名", paramType = "query", dataTypeClass=String.class), | ||||||
|             @ApiImplicitParam(name = "gender", value = "性别", paramType = "query", dataType="String"), |             @ApiImplicitParam(name = "gender", value = "性别", paramType = "query", dataTypeClass=String.class), | ||||||
|             @ApiImplicitParam(name = "deptId", value = "部门ID", paramType = "query", dataType="String") |             @ApiImplicitParam(name = "deptId", value = "部门ID", paramType = "query", dataTypeClass=String.class) | ||||||
|     }) |     }) | ||||||
|     @PreAuthorize("@ex.hasAuthority('sys:user:page')") |     @PreAuthorize("@ex.hasAuthority('sys:user:page')") | ||||||
|     public Result<PageData<SysUserDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ |     public Result<PageData<SysUserDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ | ||||||
| @@ -153,7 +153,7 @@ public class SysUserController { | |||||||
|     @GetMapping("export") |     @GetMapping("export") | ||||||
|     @ApiOperation("导出") |     @ApiOperation("导出") | ||||||
|     @LogOperation("导出") |     @LogOperation("导出") | ||||||
|     @ApiImplicitParam(name = "username", value = "用户名", paramType = "query", dataType="String") |     @ApiImplicitParam(name = "username", value = "用户名", paramType = "query", dataTypeClass=String.class) | ||||||
|     @PreAuthorize("@ex.hasAuthority('sys:user:export')") |     @PreAuthorize("@ex.hasAuthority('sys:user:export')") | ||||||
|     public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |     public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { | ||||||
|         List<SysUserDTO> list = sysUserService.list(params); |         List<SysUserDTO> list = sysUserService.list(params); | ||||||
|   | |||||||
| @@ -2,6 +2,7 @@ package com.cnbm; | |||||||
|  |  | ||||||
| import org.springframework.boot.SpringApplication; | import org.springframework.boot.SpringApplication; | ||||||
| import org.springframework.boot.autoconfigure.SpringBootApplication; | import org.springframework.boot.autoconfigure.SpringBootApplication; | ||||||
|  | import springfox.documentation.oas.annotations.EnableOpenApi; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * @Author weihongyang |  * @Author weihongyang | ||||||
| @@ -9,7 +10,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; | |||||||
|  * @Version 1.0 |  * @Version 1.0 | ||||||
|  */ |  */ | ||||||
| @SpringBootApplication | @SpringBootApplication | ||||||
|  | @EnableOpenApi | ||||||
| public class AdminApplication { | public class AdminApplication { | ||||||
|     public static void main(String[] args) { |     public static void main(String[] args) { | ||||||
|         SpringApplication.run(AdminApplication.class,args); |         SpringApplication.run(AdminApplication.class,args); | ||||||
|   | |||||||
		Referens i nytt ärende
	
	Block a user