diff --git a/common/common-framework/pom.xml b/common/common-framework/pom.xml
index 67c3f3f60..1ce29bc92 100644
--- a/common/common-framework/pom.xml
+++ b/common/common-framework/pom.xml
@@ -11,18 +11,6 @@
common-framework
-
-
-
- cn.iocoder.mall
- common-dependencies
- 1.0-SNAPSHOT
- pom
- import
-
-
-
-
diff --git a/common/mall-spring-boot-starter-swagger/pom.xml b/common/mall-spring-boot-starter-swagger/pom.xml
new file mode 100644
index 000000000..ef0181466
--- /dev/null
+++ b/common/mall-spring-boot-starter-swagger/pom.xml
@@ -0,0 +1,33 @@
+
+
+
+ common
+ cn.iocoder.mall
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ mall-spring-boot-starter-swagger
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+ org.springframework.boot
+ spring-boot-configuration-processor
+ true
+
+
+
+
+ com.github.xiaoymin
+ knife4j-spring-boot-starter
+
+
+
+
diff --git a/common/mall-spring-boot-starter-swagger/src/main/java/cn/iocoder/mall/swagger/config/SwaggerAutoConfiguration.java b/common/mall-spring-boot-starter-swagger/src/main/java/cn/iocoder/mall/swagger/config/SwaggerAutoConfiguration.java
new file mode 100644
index 000000000..fc7c887a8
--- /dev/null
+++ b/common/mall-spring-boot-starter-swagger/src/main/java/cn/iocoder/mall/swagger/config/SwaggerAutoConfiguration.java
@@ -0,0 +1,57 @@
+package cn.iocoder.mall.swagger.config;
+
+import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+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;
+
+/**
+ * 简单的 Swagger2 自动配置类
+ *
+ * 较为完善的,可以了解 https://mvnrepository.com/artifact/com.spring4all/spring-boot-starter-swagger
+ */
+@Configuration
+@EnableSwagger2
+@EnableKnife4j
+@ConditionalOnClass({Docket.class, ApiInfoBuilder.class})
+@ConditionalOnProperty(prefix = "swagger", value = "enable", matchIfMissing = true) // 允许使用 swagger.enable=false 禁用 Swagger
+@EnableConfigurationProperties(SwaggerProperties.class)
+public class SwaggerAutoConfiguration {
+
+ @Bean
+ @ConditionalOnMissingBean
+ public SwaggerProperties swaggerProperties() {
+ return new SwaggerProperties();
+ }
+
+ @Bean
+ public Docket createRestApi() {
+ SwaggerProperties properties = swaggerProperties();
+ // 创建 Docket 对象
+ return new Docket(DocumentationType.SWAGGER_2)
+ .apiInfo(apiInfo(properties))
+ .select()
+ .apis(RequestHandlerSelectors.basePackage(properties.getBasePackage()))
+ .paths(PathSelectors.any())
+ .build();
+ }
+
+ private ApiInfo apiInfo(SwaggerProperties properties) {
+ return new ApiInfoBuilder()
+ .title(properties.getTitle())
+ .description(properties.getDescription())
+ .version(properties.getVersion())
+ .build();
+ }
+
+}
diff --git a/common/mall-spring-boot-starter-swagger/src/main/java/cn/iocoder/mall/swagger/config/SwaggerProperties.java b/common/mall-spring-boot-starter-swagger/src/main/java/cn/iocoder/mall/swagger/config/SwaggerProperties.java
new file mode 100644
index 000000000..3c7c5739d
--- /dev/null
+++ b/common/mall-spring-boot-starter-swagger/src/main/java/cn/iocoder/mall/swagger/config/SwaggerProperties.java
@@ -0,0 +1,48 @@
+package cn.iocoder.mall.swagger.config;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+
+@ConfigurationProperties("swagger")
+public class SwaggerProperties {
+
+ private String title;
+ private String description;
+ private String version;
+ private String basePackage;
+
+ public String getTitle() {
+ return title;
+ }
+
+ public SwaggerProperties setTitle(String title) {
+ this.title = title;
+ return this;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public SwaggerProperties setDescription(String description) {
+ this.description = description;
+ return this;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public SwaggerProperties setVersion(String version) {
+ this.version = version;
+ return this;
+ }
+
+ public String getBasePackage() {
+ return basePackage;
+ }
+
+ public SwaggerProperties setBasePackage(String basePackage) {
+ this.basePackage = basePackage;
+ return this;
+ }
+}
diff --git a/common/mall-spring-boot-starter-swagger/src/main/java/cn/iocoder/mall/swagger/package-info.java b/common/mall-spring-boot-starter-swagger/src/main/java/cn/iocoder/mall/swagger/package-info.java
new file mode 100644
index 000000000..ed87ff7e7
--- /dev/null
+++ b/common/mall-spring-boot-starter-swagger/src/main/java/cn/iocoder/mall/swagger/package-info.java
@@ -0,0 +1 @@
+package cn.iocoder.mall.swagger;
diff --git a/common/mall-spring-boot-starter-swagger/src/main/resources/META-INF/spring.factories b/common/mall-spring-boot-starter-swagger/src/main/resources/META-INF/spring.factories
new file mode 100644
index 000000000..28fc2dc29
--- /dev/null
+++ b/common/mall-spring-boot-starter-swagger/src/main/resources/META-INF/spring.factories
@@ -0,0 +1,2 @@
+org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
+ cn.iocoder.mall.swagger.config.SwaggerAutoConfiguration
diff --git a/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/swagger/SwaggerAutoConfiguration.java b/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/swagger/SwaggerAutoConfiguration.java
index dd1748f4a..fff0db615 100644
--- a/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/swagger/SwaggerAutoConfiguration.java
+++ b/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/swagger/SwaggerAutoConfiguration.java
@@ -26,6 +26,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@ConditionalOnClass({Docket.class, ApiInfoBuilder.class})
@ConditionalOnProperty(prefix = "swagger", value = "enable", matchIfMissing = true) // 允许使用 swagger.enable=false 禁用 Swagger
@EnableConfigurationProperties(SwaggerProperties.class)
+@Deprecated
public class SwaggerAutoConfiguration {
@Bean
diff --git a/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/swagger/SwaggerProperties.java b/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/swagger/SwaggerProperties.java
index b0e1c960d..a04e224a7 100644
--- a/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/swagger/SwaggerProperties.java
+++ b/common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/swagger/SwaggerProperties.java
@@ -5,6 +5,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@Data
@ConfigurationProperties("swagger")
+@Deprecated
public class SwaggerProperties {
private String title;
diff --git a/common/pom.xml b/common/pom.xml
index 0ef966c27..cdbe831b2 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -15,7 +15,19 @@
common-framework
mall-spring-boot
common-dependencies
+ mall-spring-boot-starter-swagger
+
+
+
+ cn.iocoder.mall
+ mall-dependencies
+ 1.0-SNAPSHOT
+ pom
+ import
+
+
+
diff --git a/mall-dependencies/pom.xml b/mall-dependencies/pom.xml
new file mode 100644
index 000000000..0db67e341
--- /dev/null
+++ b/mall-dependencies/pom.xml
@@ -0,0 +1,92 @@
+
+
+
+ onemall
+ cn.iocoder.mall
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ mall-dependencies
+
+ pom
+ Onemall Dependencies
+ Maven Bom,定义 Onemall 项目的所有依赖的版本
+
+
+
+
+ 2.2.4.RELEASE
+ Hoxton.SR1
+ 2.2.0.RELEASE
+
+ 2.0.2
+
+ 2.7.1
+
+ 1.1.0
+
+ 7.0.0
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ ${spring.boot.version}
+ pom
+ import
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ ${spring.cloud.version}
+ pom
+ import
+
+
+ com.alibaba.cloud
+ spring-cloud-alibaba-dependencies
+ ${spring.cloud.alibaba.version}
+ pom
+ import
+
+
+
+
+ com.github.xiaoymin
+ knife4j-spring-boot-starter
+ ${knife4j.version}
+
+
+
+
+ org.apache.dubbo
+ dubbo
+ ${dubbo.version}
+
+
+
+
+ io.seata
+ seata-spring-boot-starter
+ ${seata.version}
+
+
+
+
+ org.apache.skywalking
+ apm-toolkit-trace
+ ${skywalking.version}
+
+
+
+
+
+
+
diff --git a/pom.xml b/pom.xml
index a117d9133..5eca5d951 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,6 +24,7 @@
promotion
search
demo
+ mall-dependencies
pom
diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/convert/ProductSpuConvert.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/convert/ProductSpuConvert.java
index 450c2ddc8..a957b51ee 100644
--- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/convert/ProductSpuConvert.java
+++ b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/convert/ProductSpuConvert.java
@@ -29,6 +29,11 @@ public interface ProductSpuConvert {
})
ProductSpuBO convert(ProductSpuDO spu);
+ @Named("translatePicUrlsFromString")
+ default List translatePicUrlsFromString(String picUrls) {
+ return StringUtil.split(picUrls, ",");
+ }
+
@Mappings({})
List convert(List spus);
@@ -125,9 +130,6 @@ public interface ProductSpuConvert {
return spuDetailList;
}
- @Named("translatePicUrlsFromString")
- default List translatePicUrlsFromString(String picUrls) {
- return StringUtil.split(picUrls, ",");
- }
+
}
diff --git a/system/pom.xml b/system/pom.xml
index 69f9d82e8..e921c3fd2 100644
--- a/system/pom.xml
+++ b/system/pom.xml
@@ -16,8 +16,8 @@
system-application
system-sdk
- system-service-api
- system-service-impl
+
+
system-rpc-api
system-rpc
system-rest
diff --git a/system/system-rest/pom.xml b/system/system-rest/pom.xml
index ba66e1fb3..6cdfd8ba9 100644
--- a/system/system-rest/pom.xml
+++ b/system/system-rest/pom.xml
@@ -25,15 +25,10 @@
org.springframework.boot
spring-boot-starter-web
-
-
- io.springfox
- springfox-swagger2
-
-
- com.github.xiaoymin
- swagger-bootstrap-ui
+ cn.iocoder.mall
+ mall-spring-boot-starter-swagger
+ 1.0-SNAPSHOT
diff --git a/system/system-rest/src/main/resources/rest.yaml b/system/system-rest/src/main/resources/rest.yaml
index 1cc2e20a1..a41390b41 100644
--- a/system/system-rest/src/main/resources/rest.yaml
+++ b/system/system-rest/src/main/resources/rest.yaml
@@ -3,3 +3,10 @@ server:
port: 18083
servlet:
context-path: /system-api/
+
+# Swagger 配置项
+swagger:
+ title: 管理员子系统
+ description: 管理员子系统
+ version: 1.0.0
+ base-package: cn.iocoder.mall.system.rest.controller