Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
57145d42
提交
57145d42
authored
4月 20, 2020
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加 swagger starter
上级
220984c4
显示空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
266 行增加
和
26 行删除
+266
-26
pom.xml
common/common-framework/pom.xml
+0
-12
pom.xml
common/mall-spring-boot-starter-swagger/pom.xml
+33
-0
SwaggerAutoConfiguration.java
...iocoder/mall/swagger/config/SwaggerAutoConfiguration.java
+57
-0
SwaggerProperties.java
...ava/cn/iocoder/mall/swagger/config/SwaggerProperties.java
+48
-0
package-info.java
...r/src/main/java/cn/iocoder/mall/swagger/package-info.java
+1
-0
spring.factories
...rter-swagger/src/main/resources/META-INF/spring.factories
+2
-0
SwaggerAutoConfiguration.java
...er/mall/spring/boot/swagger/SwaggerAutoConfiguration.java
+1
-0
SwaggerProperties.java
...n/iocoder/mall/spring/boot/swagger/SwaggerProperties.java
+1
-0
pom.xml
common/pom.xml
+12
-0
pom.xml
mall-dependencies/pom.xml
+92
-0
pom.xml
pom.xml
+1
-0
ProductSpuConvert.java
...va/cn/iocoder/mall/product/convert/ProductSpuConvert.java
+6
-4
pom.xml
system/pom.xml
+2
-2
pom.xml
system/system-rest/pom.xml
+3
-8
rest.yaml
system/system-rest/src/main/resources/rest.yaml
+7
-0
没有找到文件。
common/common-framework/pom.xml
浏览文件 @
57145d42
...
@@ -11,18 +11,6 @@
...
@@ -11,18 +11,6 @@
<artifactId>
common-framework
</artifactId>
<artifactId>
common-framework
</artifactId>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
cn.iocoder.mall
</groupId>
<artifactId>
common-dependencies
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependencies>
<!-- Web 相关 -->
<!-- Web 相关 -->
<dependency>
<dependency>
...
...
common/mall-spring-boot-starter-swagger/pom.xml
0 → 100644
浏览文件 @
57145d42
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
common
</artifactId>
<groupId>
cn.iocoder.mall
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
mall-spring-boot-starter-swagger
</artifactId>
<dependencies>
<!-- Spring 核心 -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-configuration-processor
</artifactId>
<optional>
true
</optional>
</dependency>
<!-- Web 相关 -->
<dependency>
<groupId>
com.github.xiaoymin
</groupId>
<artifactId>
knife4j-spring-boot-starter
</artifactId>
</dependency>
</dependencies>
</project>
common/mall-spring-boot-starter-swagger/src/main/java/cn/iocoder/mall/swagger/config/SwaggerAutoConfiguration.java
0 → 100644
浏览文件 @
57145d42
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
();
}
}
common/mall-spring-boot-starter-swagger/src/main/java/cn/iocoder/mall/swagger/config/SwaggerProperties.java
0 → 100644
浏览文件 @
57145d42
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
;
}
}
common/mall-spring-boot-starter-swagger/src/main/java/cn/iocoder/mall/swagger/package-info.java
0 → 100644
浏览文件 @
57145d42
package
cn
.
iocoder
.
mall
.
swagger
;
common/mall-spring-boot-starter-swagger/src/main/resources/META-INF/spring.factories
0 → 100644
浏览文件 @
57145d42
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
cn.iocoder.mall.swagger.config.SwaggerAutoConfiguration
common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/swagger/SwaggerAutoConfiguration.java
浏览文件 @
57145d42
...
@@ -26,6 +26,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
...
@@ -26,6 +26,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@ConditionalOnClass
({
Docket
.
class
,
ApiInfoBuilder
.
class
})
@ConditionalOnClass
({
Docket
.
class
,
ApiInfoBuilder
.
class
})
@ConditionalOnProperty
(
prefix
=
"swagger"
,
value
=
"enable"
,
matchIfMissing
=
true
)
// 允许使用 swagger.enable=false 禁用 Swagger
@ConditionalOnProperty
(
prefix
=
"swagger"
,
value
=
"enable"
,
matchIfMissing
=
true
)
// 允许使用 swagger.enable=false 禁用 Swagger
@EnableConfigurationProperties
(
SwaggerProperties
.
class
)
@EnableConfigurationProperties
(
SwaggerProperties
.
class
)
@Deprecated
public
class
SwaggerAutoConfiguration
{
public
class
SwaggerAutoConfiguration
{
@Bean
@Bean
...
...
common/mall-spring-boot/src/main/java/cn/iocoder/mall/spring/boot/swagger/SwaggerProperties.java
浏览文件 @
57145d42
...
@@ -5,6 +5,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
...
@@ -5,6 +5,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
@Data
@Data
@ConfigurationProperties
(
"swagger"
)
@ConfigurationProperties
(
"swagger"
)
@Deprecated
public
class
SwaggerProperties
{
public
class
SwaggerProperties
{
private
String
title
;
private
String
title
;
...
...
common/pom.xml
浏览文件 @
57145d42
...
@@ -15,7 +15,19 @@
...
@@ -15,7 +15,19 @@
<module>
common-framework
</module>
<module>
common-framework
</module>
<module>
mall-spring-boot
</module>
<module>
mall-spring-boot
</module>
<module>
common-dependencies
</module>
<module>
common-dependencies
</module>
<module>
mall-spring-boot-starter-swagger
</module>
</modules>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
cn.iocoder.mall
</groupId>
<artifactId>
mall-dependencies
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
</project>
mall-dependencies/pom.xml
0 → 100644
浏览文件 @
57145d42
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
onemall
</artifactId>
<groupId>
cn.iocoder.mall
</groupId>
<version>
1.0-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
mall-dependencies
</artifactId>
<packaging>
pom
</packaging>
<name>
Onemall Dependencies
</name>
<description>
Maven Bom,定义 Onemall 项目的所有依赖的版本
</description>
<!-- 属性 -->
<properties>
<!-- TODO Spring Boot && Spring Cloud && Spring Cloud Alibaba -->
<spring.boot.version>
2.2.4.RELEASE
</spring.boot.version>
<spring.cloud.version>
Hoxton.SR1
</spring.cloud.version>
<spring.cloud.alibaba.version>
2.2.0.RELEASE
</spring.cloud.alibaba.version>
<!-- Web 相关 -->
<knife4j.version>
2.0.2
</knife4j.version>
<!-- RPC 相关 -->
<dubbo.version>
2.7.1
</dubbo.version>
<!-- Transaction 相关 -->
<seata.version>
1.1.0
</seata.version>
<!-- 监控相关 -->
<skywalking.version>
7.0.0
</skywalking.version>
</properties>
<!-- 依赖管理 -->
<dependencyManagement>
<!-- TODO Spring Boot && Spring Cloud && Spring Cloud Alibaba -->
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
${spring.boot.version}
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-dependencies
</artifactId>
<version>
${spring.cloud.version}
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
<dependency>
<groupId>
com.alibaba.cloud
</groupId>
<artifactId>
spring-cloud-alibaba-dependencies
</artifactId>
<version>
${spring.cloud.alibaba.version}
</version>
<type>
pom
</type>
<scope>
import
</scope>
</dependency>
<!-- Web 相关 -->
<dependency>
<groupId>
com.github.xiaoymin
</groupId>
<artifactId>
knife4j-spring-boot-starter
</artifactId>
<version>
${knife4j.version}
</version>
</dependency>
<!-- RPC 相关 -->
<dependency>
<groupId>
org.apache.dubbo
</groupId>
<artifactId>
dubbo
</artifactId>
<version>
${dubbo.version}
</version>
</dependency>
<!-- Transaction 相关 -->
<dependency>
<groupId>
io.seata
</groupId>
<artifactId>
seata-spring-boot-starter
</artifactId>
<version>
${seata.version}
</version>
</dependency>
<!-- 监控相关 -->
<dependency>
<groupId>
org.apache.skywalking
</groupId>
<artifactId>
apm-toolkit-trace
</artifactId>
<version>
${skywalking.version}
</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
pom.xml
浏览文件 @
57145d42
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
<module>
promotion
</module>
<module>
promotion
</module>
<module>
search
</module>
<module>
search
</module>
<module>
demo
</module>
<module>
demo
</module>
<module>
mall-dependencies
</module>
</modules>
</modules>
<packaging>
pom
</packaging>
<packaging>
pom
</packaging>
...
...
product/product-service-impl/src/main/java/cn/iocoder/mall/product/convert/ProductSpuConvert.java
浏览文件 @
57145d42
...
@@ -29,6 +29,11 @@ public interface ProductSpuConvert {
...
@@ -29,6 +29,11 @@ public interface ProductSpuConvert {
})
})
ProductSpuBO
convert
(
ProductSpuDO
spu
);
ProductSpuBO
convert
(
ProductSpuDO
spu
);
@Named
(
"translatePicUrlsFromString"
)
default
List
<
String
>
translatePicUrlsFromString
(
String
picUrls
)
{
return
StringUtil
.
split
(
picUrls
,
","
);
}
@Mappings
({})
@Mappings
({})
List
<
ProductSpuBO
>
convert
(
List
<
ProductSpuDO
>
spus
);
List
<
ProductSpuBO
>
convert
(
List
<
ProductSpuDO
>
spus
);
...
@@ -125,9 +130,6 @@ public interface ProductSpuConvert {
...
@@ -125,9 +130,6 @@ public interface ProductSpuConvert {
return
spuDetailList
;
return
spuDetailList
;
}
}
@Named
(
"translatePicUrlsFromString"
)
default
List
<
String
>
translatePicUrlsFromString
(
String
picUrls
)
{
return
StringUtil
.
split
(
picUrls
,
","
);
}
}
}
system/pom.xml
浏览文件 @
57145d42
...
@@ -16,8 +16,8 @@
...
@@ -16,8 +16,8 @@
<modules>
<modules>
<module>
system-application
</module>
<module>
system-application
</module>
<module>
system-sdk
</module>
<module>
system-sdk
</module>
<module>
system-service-api
</module
>
<!-- <module>system-service-api</module>--
>
<module>
system-service-impl
</module
>
<!-- <module>system-service-impl</module>--
>
<module>
system-rpc-api
</module>
<module>
system-rpc-api
</module>
<module>
system-rpc
</module>
<module>
system-rpc
</module>
<module>
system-rest
</module>
<module>
system-rest
</module>
...
...
system/system-rest/pom.xml
浏览文件 @
57145d42
...
@@ -25,15 +25,10 @@
...
@@ -25,15 +25,10 @@
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
</dependency>
<!-- TODO 实现自己的 starter -->
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
</dependency>
<dependency>
<dependency>
<groupId>
com.github.xiaoymin
</groupId>
<groupId>
cn.iocoder.mall
</groupId>
<artifactId>
swagger-bootstrap-ui
</artifactId>
<artifactId>
mall-spring-boot-starter-swagger
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
</dependency>
</dependencies>
</dependencies>
...
...
system/system-rest/src/main/resources/rest.yaml
浏览文件 @
57145d42
...
@@ -3,3 +3,10 @@ server:
...
@@ -3,3 +3,10 @@ server:
port
:
18083
port
:
18083
servlet
:
servlet
:
context-path
:
/system-api/
context-path
:
/system-api/
# Swagger 配置项
swagger
:
title
:
管理员子系统
description
:
管理员子系统
version
:
1.0.0
base-package
:
cn.iocoder.mall.system.rest.controller
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论