/**
* 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("/");
}