diff --git a/README.md b/README.md index 887f381..5d84993 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Spring Boot Demo -spring boot demo 是一个用来学习 spring boot 的项目,已经集成 actuator、logback、jpa、mybatis、redis缓存、swagger模块,后续会集成activemq,email, freemarker,shiro,websocket,quartz,netty等模块。 +spring boot demo 是一个用来学习 spring boot 的项目,已经集成 actuator(监控)、logback(日志)、JPA(ORM 框架)、mybatis(ORM 框架)、redis-cache(缓存)、swagger(API 接口管理测试)、ureport2(中国式报表)模块,后续会集成activemq,email, freemarker,shiro,websocket,quartz,netty等模块。 依赖的 Spring Boot 版本: @@ -42,6 +42,7 @@ spring boot demo 是一个用来学习 spring boot 的项目,已经集成 actu ../spring-boot-demo-mybatis ../spring-boot-demo-cache-redis ../spring-boot-demo-swagger + ../spring-boot-demo-ureport2 @@ -136,6 +137,7 @@ spring boot demo 是一个用来学习 spring boot 的项目,已经集成 actu | [spring-boot-demo-mybatis](./spring-boot-demo-mybatis) | spring-boot 集成 [mybatis-spring-boot-starter](https://github.com/mybatis/spring-boot-starter)、[mybatis-spring-boot-starter](https://github.com/alibaba/druid/tree/master/druid-spring-boot-starter) | | [spring-boot-demo-cache-redis](./spring-boot-demo-cache-redis) | spring-boot 使用 Redis 做缓存 | | [spring-boot-demo-swagger](./spring-boot-demo-swagger) | spring-boot 集成 [spring-boot-starter-swagger](https://github.com/SpringForAll/spring-boot-starter-swagger) (由大佬[翟永超](http://blog.didispace.com/)开源)用于统一管理、测试 API 接口 | +| [spring-boot-demo-ureport2](./spring-boot-demo-ureport2) | spring-boot 集成 [ureport2](https://github.com/youseries/ureport) 实现自定义报表(ureport2可以轻松实现复杂的中国式报表,功能十分强大) | # 官方提供的 starter 介绍 diff --git a/spring-boot-demo-parent/pom.xml b/spring-boot-demo-parent/pom.xml index df4cdef..43a0e9f 100644 --- a/spring-boot-demo-parent/pom.xml +++ b/spring-boot-demo-parent/pom.xml @@ -20,6 +20,7 @@ ../spring-boot-demo-mybatis ../spring-boot-demo-cache-redis ../spring-boot-demo-swagger + ../spring-boot-demo-ureport2 diff --git a/spring-boot-demo-ureport2/README.md b/spring-boot-demo-ureport2/README.md new file mode 100644 index 0000000..d918e89 --- /dev/null +++ b/spring-boot-demo-ureport2/README.md @@ -0,0 +1,99 @@ +# spring-boot-demo-ureport2 + +依赖 [spring-boot-demo-parent](../spring-boot-demo-parent)、[ureport2](https://github.com/youseries/ureport) (ureport2 可以轻松实现复杂的中国式报表,功能十分强大) + +### pom.xml + +```xml + + + 4.0.0 + + spring-boot-demo-ureport2 + 0.0.1-SNAPSHOT + war + + spring-boot-demo-ureport2 + Demo project for Spring Boot + + + com.xkcoding + spring-boot-demo-parent + 0.0.1-SNAPSHOT + ../spring-boot-demo-parent/pom.xml + + + + 2.2 + + + + + com.bstek.ureport + ureport2-console + ${ureport2.version} + + + + + spring-boot-demo-ureport2 + + + +``` + +### UReportConfiguration.java + +```java +@Configuration +@ImportResource("classpath:ureport-context.xml") +public class UReportConfiguration { + + @Bean + public ServletRegistrationBean initUReport() { + return new ServletRegistrationBean(new UReportServlet(), "/ureport/*"); + } +} +``` + +### ureport-context.xml + +```xml + + + + + + + + classpath:ureport-config.properties + + + +``` + +### ureport-config.properties + +```properties +# 配置模板存放的位置 +ureport.fileStoreDir=/Users/yangkai.shen/Documents/code/back-end/spring-boot-demo/spring-boot-demo-ureport2/src/main/resources/ureportfiles +``` + +### resources目录 + +``` +resources +├── application.yml···························spring boot 配置文件 +├── export····································运行 demo 示例后,导出的文件 +│   ├── ureport.docx··························导出的 word 文件 +│   ├── ureport.pdf···························导出的 PDF 文件 +│   └── ureport.xlsx··························导出的 Excel 文件 +├── ureport-config.properties·················ureport2 自定义的一些配置信息,比如模板存放路径 +├── ureport-context.xml·······················ureport2 的配置文件 +└── ureportfiles······························用于存放 ureport2 的模板文件 + └── ureport-demo.ureport.xml··············demo 示例的模板文件 +``` + diff --git a/spring-boot-demo-ureport2/pom.xml b/spring-boot-demo-ureport2/pom.xml new file mode 100644 index 0000000..70fdd22 --- /dev/null +++ b/spring-boot-demo-ureport2/pom.xml @@ -0,0 +1,36 @@ + + + 4.0.0 + + spring-boot-demo-ureport2 + 0.0.1-SNAPSHOT + war + + spring-boot-demo-ureport2 + Demo project for Spring Boot + + + com.xkcoding + spring-boot-demo-parent + 0.0.1-SNAPSHOT + ../spring-boot-demo-parent/pom.xml + + + + 2.2 + + + + + com.bstek.ureport + ureport2-console + ${ureport2.version} + + + + + spring-boot-demo-ureport2 + + + \ No newline at end of file diff --git a/spring-boot-demo-ureport2/src/main/java/com/xkcoding/springbootdemoureport2/SpringBootDemoUreport2Application.java b/spring-boot-demo-ureport2/src/main/java/com/xkcoding/springbootdemoureport2/SpringBootDemoUreport2Application.java new file mode 100644 index 0000000..5551812 --- /dev/null +++ b/spring-boot-demo-ureport2/src/main/java/com/xkcoding/springbootdemoureport2/SpringBootDemoUreport2Application.java @@ -0,0 +1,12 @@ +package com.xkcoding.springbootdemoureport2; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SpringBootDemoUreport2Application { + + public static void main(String[] args) { + SpringApplication.run(SpringBootDemoUreport2Application.class, args); + } +} diff --git a/spring-boot-demo-ureport2/src/main/resources/application.yml b/spring-boot-demo-ureport2/src/main/resources/application.yml new file mode 100644 index 0000000..3cae10b --- /dev/null +++ b/spring-boot-demo-ureport2/src/main/resources/application.yml @@ -0,0 +1,3 @@ +server: + port: 8080 + context-path: /demo \ No newline at end of file diff --git a/spring-boot-demo-ureport2/src/main/resources/export/ureport.docx b/spring-boot-demo-ureport2/src/main/resources/export/ureport.docx new file mode 100644 index 0000000..3f56419 Binary files /dev/null and b/spring-boot-demo-ureport2/src/main/resources/export/ureport.docx differ diff --git a/spring-boot-demo-ureport2/src/main/resources/export/ureport.pdf b/spring-boot-demo-ureport2/src/main/resources/export/ureport.pdf new file mode 100644 index 0000000..025c436 Binary files /dev/null and b/spring-boot-demo-ureport2/src/main/resources/export/ureport.pdf differ diff --git a/spring-boot-demo-ureport2/src/main/resources/export/ureport.xlsx b/spring-boot-demo-ureport2/src/main/resources/export/ureport.xlsx new file mode 100644 index 0000000..4d5da3b Binary files /dev/null and b/spring-boot-demo-ureport2/src/main/resources/export/ureport.xlsx differ diff --git a/spring-boot-demo-ureport2/src/main/resources/ureport-config.properties b/spring-boot-demo-ureport2/src/main/resources/ureport-config.properties new file mode 100644 index 0000000..956cbfa --- /dev/null +++ b/spring-boot-demo-ureport2/src/main/resources/ureport-config.properties @@ -0,0 +1,2 @@ +# 配置模板存放的位置 +ureport.fileStoreDir=/Users/yangkai.shen/Documents/code/back-end/spring-boot-demo/spring-boot-demo-ureport2/src/main/resources/ureportfiles \ No newline at end of file diff --git a/spring-boot-demo-ureport2/src/main/resources/ureport-context.xml b/spring-boot-demo-ureport2/src/main/resources/ureport-context.xml new file mode 100644 index 0000000..04da7bd --- /dev/null +++ b/spring-boot-demo-ureport2/src/main/resources/ureport-context.xml @@ -0,0 +1,13 @@ + + + + + + + + classpath:ureport-config.properties + + + \ No newline at end of file diff --git a/spring-boot-demo-ureport2/src/main/resources/ureportfiles/ureport-demo.ureport.xml b/spring-boot-demo-ureport2/src/main/resources/ureportfiles/ureport-demo.ureport.xml new file mode 100644 index 0000000..f36e1ee --- /dev/null +++ b/spring-boot-demo-ureport2/src/main/resources/ureportfiles/ureport-demo.ureport.xml @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/spring-boot-demo-ureport2/src/test/java/com/xkcoding/springbootdemoureport2/SpringBootDemoUreport2ApplicationTests.java b/spring-boot-demo-ureport2/src/test/java/com/xkcoding/springbootdemoureport2/SpringBootDemoUreport2ApplicationTests.java new file mode 100644 index 0000000..67839c0 --- /dev/null +++ b/spring-boot-demo-ureport2/src/test/java/com/xkcoding/springbootdemoureport2/SpringBootDemoUreport2ApplicationTests.java @@ -0,0 +1,16 @@ +package com.xkcoding.springbootdemoureport2; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class SpringBootDemoUreport2ApplicationTests { + + @Test + public void contextLoads() { + } + +}