/**
* api信息
*
* @param name 標題
* @param description 描述
* @param version 版本
* @return
*/
private ApiInfo apiInfo(String name, String description, String version) {
return new ApiInfoBuilder().title(name).description(description).version(version).build();
}
//定義不一樣的Docket 進行分組展現api 能夠使用包來區分,也能夠取使用路由來區分
//這是按包來分組
// @Bean
// public Docket api() {
// return new Docket(DocumentationType.SWAGGER_2)
// .apiInfo(apiInfo())
// .select()
// .apis(RequestHandlerSelectors.basePackage("com.meike.station"))
// .paths(PathSelectors.any())
// .build()
// .groupName("api組");
// }
/**
* 按照路由來分組
*
* @return
*/
@Bean
public Docket web_api_admin() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo("admin-api", "系統管理員", "1.0"))
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.ant("/api/admin/**"))
.build()
.groupName("系統管理員:web-admin-接口文檔V1.0")
.pathMapping("/");
}
@Bean
public Docket web_api_bm() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo("bm-api", "商家管理員", "1.0"))
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.ant("/api/business/manager/**"))
.build()
.groupName("商家管理員:web-bm-接口文檔V1.0")
.pathMapping("/");
}
@Bean
public Docket web_api_bo() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo("bo-api", "商家運營", "1.0"))
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.ant("/api/business/operation/**"))
.build()
.groupName("商家運營:web-bo-接口文檔V1.0")
.pathMapping("/");
}
@Bean
public Docket web_api_sm() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo("sm-api", "站管理員", "1.0"))
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.ant("/api/station/manager/**"))
.build()
.groupName("站管理員:web-sm-接口文檔V1.0")
.pathMapping("/");
}
@Bean
public Docket web_api_so() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo("so-api", "站運營", "1.0"))
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.ant("/api/station/operation/**"))
.build()
.groupName("站運營:web-so-接口文檔V1.0")
.pathMapping("/");
}
@Bean
public Docket xcx_api() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo("xcx-api", "小程序", "1.0"))
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.ant("/xcx/**"))
.build()
.groupName("小程序:xcx-接口文檔V1.0")
.pathMapping("/");
}