|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Value; | 
|---|
|  |  |  | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | 
|---|
|  |  |  | import org.springframework.boot.context.properties.ConfigurationProperties; | 
|---|
|  |  |  | import org.springframework.context.annotation.Bean; | 
|---|
|  |  |  | import org.springframework.context.annotation.Configuration; | 
|---|
|  |  |  | import springfox.documentation.builders.ApiInfoBuilder; | 
|---|
|  |  |  | 
|---|
|  |  |  | .required(false).build(); | 
|---|
|  |  |  | parameters.add(parameterBuilder.build()); | 
|---|
|  |  |  | return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).enable(swaggerEnable).select().apis(RequestHandlerSelectors.withClassAnnotation(Api.class)) | 
|---|
|  |  |  | .paths(PathSelectors.any()).build().globalOperationParameters(parameters); | 
|---|
|  |  |  | .paths(PathSelectors.ant("/api/**")).build().globalOperationParameters(parameters).groupName("HIVE"); | 
|---|
|  |  |  | //                .ignoredParameterTypes(MemberEntity.class); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | .version("1.0") | 
|---|
|  |  |  | .build(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Bean | 
|---|
|  |  |  | public Docket wxRestApi(){ | 
|---|
|  |  |  | // 添加请求参数,我们这里把token作为请求头部参数传入后端 | 
|---|
|  |  |  | ParameterBuilder parameterBuilder = new ParameterBuilder(); | 
|---|
|  |  |  | List<Parameter> parameters = new ArrayList<Parameter>(); | 
|---|
|  |  |  | parameterBuilder.name("token").description("令牌").modelRef(new ModelRef("string")).parameterType("header") | 
|---|
|  |  |  | .required(true).build(); | 
|---|
|  |  |  | parameters.add(parameterBuilder.build()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ParameterBuilder parameterBuilder2 = new ParameterBuilder(); | 
|---|
|  |  |  | parameterBuilder2.name("companyCode").description("公司编码tangqiaqia.jyymatrix.cc").modelRef(new ModelRef("string")).parameterType("header") | 
|---|
|  |  |  | .required(true).build(); | 
|---|
|  |  |  | parameters.add(parameterBuilder2.build()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return new Docket(DocumentationType.SWAGGER_2).apiInfo(wxApiInfo()).enable(swaggerEnable).select().apis(RequestHandlerSelectors.withClassAnnotation(Api.class)) | 
|---|
|  |  |  | .paths(PathSelectors.ant("/wxapi/**")).build().globalOperationParameters(parameters).groupName("小程序接口"); | 
|---|
|  |  |  | //                .ignoredParameterTypes(MemberEntity.class); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private ApiInfo wxApiInfo(){ | 
|---|
|  |  |  | return new ApiInfoBuilder() | 
|---|
|  |  |  | .title("Hive Wx") | 
|---|
|  |  |  | .description("This is a restful api document of Hive Wx.") | 
|---|
|  |  |  | .version("1.0") | 
|---|
|  |  |  | .build(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Bean | 
|---|
|  |  |  | public Docket ERPApi(){ | 
|---|
|  |  |  | // 添加请求参数,我们这里把token作为请求头部参数传入后端 | 
|---|
|  |  |  | ParameterBuilder parameterBuilder = new ParameterBuilder(); | 
|---|
|  |  |  | List<Parameter> parameters = new ArrayList<Parameter>(); | 
|---|
|  |  |  | parameterBuilder.name("token").description("令牌").modelRef(new ModelRef("string")).parameterType("header") | 
|---|
|  |  |  | .required(true).build(); | 
|---|
|  |  |  | parameters.add(parameterBuilder.build()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return new Docket(DocumentationType.SWAGGER_2).apiInfo(ERPApiInfo()).enable(swaggerEnable).select().apis(RequestHandlerSelectors.withClassAnnotation(Api.class)) | 
|---|
|  |  |  | .paths(PathSelectors.ant("/admin/**")).build().globalOperationParameters(parameters).groupName("ERP接口"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private ApiInfo ERPApiInfo(){ | 
|---|
|  |  |  | return new ApiInfoBuilder() | 
|---|
|  |  |  | .title("Hive ERP") | 
|---|
|  |  |  | .description("This is a restful api document of Hive ERP.") | 
|---|
|  |  |  | .version("1.0") | 
|---|
|  |  |  | .build(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|