|
|
@@ -0,0 +1,64 @@
|
|
|
+package com.nb.core.doc;
|
|
|
+
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
|
+import org.springframework.context.annotation.Profile;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+import springfox.documentation.builders.ParameterBuilder;
|
|
|
+import springfox.documentation.builders.PathSelectors;
|
|
|
+import springfox.documentation.builders.RequestHandlerSelectors;
|
|
|
+import springfox.documentation.schema.ModelRef;
|
|
|
+import springfox.documentation.service.Parameter;
|
|
|
+import springfox.documentation.spi.DocumentationType;
|
|
|
+import springfox.documentation.spring.web.plugins.Docket;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author lifang
|
|
|
+ * @version 1.0.0
|
|
|
+ * @ClassName SwaggerDocConfig.java
|
|
|
+ * @Description TODO
|
|
|
+ * @createTime 2022年08月01日 22:01:00
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class SwaggerDocConfig {
|
|
|
+ @Bean
|
|
|
+ @Profile("dev")
|
|
|
+ public Docket system(){
|
|
|
+ return new Docket(DocumentationType.SWAGGER_2)
|
|
|
+ .select()
|
|
|
+ .apis(RequestHandlerSelectors.basePackage("com.nb.system.controller"))
|
|
|
+ .paths(PathSelectors.any())
|
|
|
+ .build()
|
|
|
+ .groupName("系统模块");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Bean
|
|
|
+ public Docket bus(){
|
|
|
+ return new Docket(DocumentationType.SWAGGER_2)
|
|
|
+ .select()
|
|
|
+ .apis(RequestHandlerSelectors.basePackage("com.nb.bus.controller"))
|
|
|
+ .paths(PathSelectors.any())
|
|
|
+ .build()
|
|
|
+ .groupName("业务模块");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Bean
|
|
|
+ public Docket admin(){
|
|
|
+ ParameterBuilder ticketPar = new ParameterBuilder();
|
|
|
+ List<Parameter> pars = new ArrayList<Parameter>();
|
|
|
+ ticketPar.name("tenantId").description("租户id")
|
|
|
+ .modelRef(new ModelRef("string")).parameterType("query")
|
|
|
+ .required(true).build();
|
|
|
+ pars.add(ticketPar.build());
|
|
|
+
|
|
|
+ return new Docket(DocumentationType.SWAGGER_2)
|
|
|
+ .select()
|
|
|
+ .apis(RequestHandlerSelectors.basePackage("com.nb.auth.controller"))
|
|
|
+ .paths(PathSelectors.any())
|
|
|
+ .build()
|
|
|
+ .groupName("授权模块");
|
|
|
+ }
|
|
|
+}
|