diff --git a/pom.xml b/pom.xml index 5a4aa7d..313efe3 100644 --- a/pom.xml +++ b/pom.xml @@ -181,17 +181,16 @@ 2.11.1 - - org.springdoc - springdoc-openapi-ui - 1.6.14 + io.springfox + springfox-swagger2 + 2.9.2 - org.webjars - swagger-ui - 4.15.5 + io.springfox + springfox-swagger-ui + 2.9.2 @@ -249,32 +248,6 @@ - - org.apache.maven.plugins - maven-dependency-plugin - 3.6.0 - - - unpack - process-resources - - unpack - - - - - org.webjars - swagger-ui - 4.15.5 - jar - ${project.build.outputDirectory} - META-INF/resources/** - - - - - - org.apache.maven.plugins maven-source-plugin diff --git a/src/main/java/com/sczx/store/config/SpringDocConfig.java b/src/main/java/com/sczx/store/config/SpringDocConfig.java deleted file mode 100644 index c6b742d..0000000 --- a/src/main/java/com/sczx/store/config/SpringDocConfig.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.sczx.store.config; - - -import org.springdoc.core.GroupedOpenApi; -import org.springframework.context.annotation.Bean; - -//@Configuration -public class SpringDocConfig { - @Bean - public GroupedOpenApi publicApi() { - return GroupedOpenApi.builder() - .group("sczx-service") - .packagesToScan("com.sczx.app.controller") - .build(); - } -} diff --git a/src/main/java/com/sczx/store/config/SwaggerConfig.java b/src/main/java/com/sczx/store/config/SwaggerConfig.java new file mode 100644 index 0000000..2580610 --- /dev/null +++ b/src/main/java/com/sczx/store/config/SwaggerConfig.java @@ -0,0 +1,35 @@ +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.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +@Configuration +@EnableSwagger2 +public class SwaggerConfig { + @Bean + public Docket createRestApi() { + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()) + .select() + .apis(RequestHandlerSelectors.basePackage("com.sczx.store.controller")) // 修改为你的 controller 包路径 + .paths(PathSelectors.any()) + .build(); + } + + private ApiInfo apiInfo() { + return new ApiInfoBuilder() + .title("门店服务接口文档") + .description("sczx_store门店服务接口文档文档") + .version("1.0") + .build(); + } +} diff --git a/src/main/java/com/sczx/store/config/WebConfig.java b/src/main/java/com/sczx/store/config/WebConfig.java index 01d76c1..271868e 100644 --- a/src/main/java/com/sczx/store/config/WebConfig.java +++ b/src/main/java/com/sczx/store/config/WebConfig.java @@ -13,8 +13,8 @@ import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.List; -@Configuration -@EnableWebMvc +//@Configuration +//@EnableWebMvc public class WebConfig implements WebMvcConfigurer { @Override diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 862e080..ff4bb90 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -68,11 +68,11 @@ hystrix: thread: timeoutInMilliseconds: 10000 # 默认熔断超时时间 -springdoc: - swagger-ui: - url: /v3/api-docs - path: /doc.html - packages-to-scan: com.sczx.store.controller # 替换为你的 controller 包路径 +#springdoc: +# swagger-ui: +# url: /v3/api-docs +# path: /doc.html +# packages-to-scan: com.sczx.store.controller # 替换为你的 controller 包路径 mybatis-plus: mapper-locations: classpath*:mapper/**/*.xml @@ -81,6 +81,6 @@ mybatis-plus: mapUnderscoreToCamelCase: true log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 控制台打印 SQL(调试用) -#auth: -# secret-key: his-is-a-very-long-and-secure-secret-key-for-jwt-signing-please-dont-use-short-keys -# token-expiration: 86400000 # 24小时 +auth: + secret-key: his-is-a-very-long-and-secure-secret-key-for-jwt-signing-please-dont-use-short-keys + token-expiration: 86400000 # 24小时 diff --git a/src/test/java/com/sczx/store/CodeGenerator.java b/src/test/java/com/sczx/store/CodeGenerator.java index 42b726a..b1bb0ec 100644 --- a/src/test/java/com/sczx/store/CodeGenerator.java +++ b/src/test/java/com/sczx/store/CodeGenerator.java @@ -11,9 +11,9 @@ import java.util.Collections; public class CodeGenerator { private static final String parentPackage = "com.sczx.store"; - private static final String jdbcUrl = "jdbc:mysql://115.190.8.52:3306/sczx?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&useSSL=false&serverTimezone=Asia/Shanghai"; + private static final String jdbcUrl = "jdbc:mysql://115.190.8.52:3306/sczx?useUnicode=true&characterEncoding=UTF-8&allowPublicKeyRetrieval=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&useSSL=false&serverTimezone=Asia/Shanghai"; private static final String username = "sczx_user"; - private static final String password = "Sczx123"; + private static final String password = "Sczx123@"; private static final String author = "zhangli"; public static void main(String[] args) { DataSourceConfig.Builder DATA_SOURCE_CONFIG = new DataSourceConfig.Builder(jdbcUrl, username, password); @@ -25,12 +25,12 @@ public class CodeGenerator { .dateType(DateType.TIME_PACK).commentDate("yyyy-MM-dd HH:mm:ss") .fileOverride()) // 包配置 - .packageConfig(builder -> builder.parent(parentPackage).entity("po.base").service("repository.base").serviceImpl("repository.base.impl").xml("") + .packageConfig(builder -> builder.parent(parentPackage).entity("po.base").service("repository.base").serviceImpl("repository.impl.base").xml("") .mapper("mapper.base").pathInfo(Collections.singletonMap(OutputFile.mapperXml, System.getProperty("user.dir") + "/src/main/resources/mapper/base"))) // 策略配置 .strategyConfig((scanner, builder) -> builder.addInclude(scanner.apply("请输入表名:")) - .addTablePrefix("t_"/*,"cd_"*/)//可支持多个,按逗号分隔 + .addTablePrefix("zc_"/*,"zd_"*/)//可支持多个,按逗号分隔 .entityBuilder().formatFileName("%sPO").enableLombok() .mapperBuilder().formatMapperFileName("%sMapper").formatXmlFileName("%sMapper") .controllerBuilder().formatFileName("%sController").enableRestStyle()