增加swagger接口输入
This commit is contained in:
		| @ -1,17 +1,20 @@ | ||||
| package com.sczx.store.config; | ||||
|  | ||||
|  | ||||
|  | ||||
| import org.springframework.context.annotation.Bean; | ||||
| import org.springframework.context.annotation.Configuration; | ||||
| import springfox.documentation.builders.ApiInfoBuilder; | ||||
| import springfox.documentation.builders.ParameterBuilder; | ||||
| import springfox.documentation.builders.PathSelectors; | ||||
| import springfox.documentation.builders.RequestHandlerSelectors; | ||||
| import springfox.documentation.schema.ModelRef; | ||||
| import springfox.documentation.service.ApiInfo; | ||||
| import springfox.documentation.spi.DocumentationType; | ||||
| import springfox.documentation.spring.web.plugins.Docket; | ||||
| import springfox.documentation.swagger2.annotations.EnableSwagger2; | ||||
|  | ||||
| import java.util.Arrays; | ||||
|  | ||||
| @Configuration | ||||
| @EnableSwagger2 | ||||
| public class SwaggerConfig { | ||||
| @ -22,7 +25,16 @@ public class SwaggerConfig { | ||||
|                 .select() | ||||
|                 .apis(RequestHandlerSelectors.basePackage("com.sczx.store.controller")) // 修改为你的 controller 包路径 | ||||
|                 .paths(PathSelectors.any()) | ||||
|                 .build(); | ||||
|                 .build() | ||||
|                 .globalOperationParameters(Arrays.asList( | ||||
|                         new ParameterBuilder() | ||||
|                                 .name("Authorization") | ||||
|                                 .description("Bearer Token") | ||||
|                                 .modelRef(new ModelRef("string")) | ||||
|                                 .parameterType("header") | ||||
|                                 .required(true) | ||||
|                                 .build() | ||||
|                 )); | ||||
|     } | ||||
|  | ||||
|     private ApiInfo apiInfo() { | ||||
|  | ||||
| @ -28,8 +28,12 @@ public class StoreClientController { | ||||
|     private StoreService storeService; | ||||
|  | ||||
|     @ApiOperation(value = "根据经纬度查询门店信息") | ||||
| //    @ApiImplicitParams({ | ||||
| //            @ApiImplicitParam(name = "Authorization", value = "Bearer Token", required = true, dataType = "string", paramType = "header"), | ||||
| //            @ApiImplicitParam(name = "Accept-Language", value = "语言标识,如 zh-CN", required = false, dataType = "string", paramType = "header") | ||||
| //    }) | ||||
|     @PostMapping("/listStoresByBBoxWithDistance") | ||||
|     Result<IPage<CompanyStoreDTO>> listStoresByBBoxWithDistance(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestBody StoreDistanceReq storeDistanceReq){ | ||||
|     Result<IPage<CompanyStoreDTO>> listStoresByBBoxWithDistance(@RequestParam(name = "pageNo", required = false, defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", required = false, defaultValue = "10") Integer pageSize, @RequestBody StoreDistanceReq storeDistanceReq){ | ||||
|         return Result.ok(storeService.listStoresByBBoxWithDistance(storeDistanceReq, pageNo, pageSize)); | ||||
|     } | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user