forked from xkcoding/spring-boot-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
168 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
UReport2 是一款基于架构在 Spring 之上纯 Java 的高性能报表引擎,通过迭代单元格可以实现任意复杂的中国式报表。 在 UReport2 中,提供了全新的基于网页的报表设计器,可以在 Chrome、Firefox、Edge 等各种主流浏览器运行(IE 浏览器除外)。使用 UReport2,打开浏览器即可完成各种复杂报表的设计制作 | ||
|
||
[https://www.w3cschool.cn/ureport](https://www.w3cschool.cn/ureport) | ||
|
||
## 单机使用 | ||
|
||
- 1. 引入 jar 依赖 | ||
|
||
```xml | ||
|
||
<dependency> | ||
<groupId>com.pig4cloud.plugin</groupId> | ||
<artifactId>ureport-spring-boot-starter</artifactId> | ||
<version>0.0.1</version> | ||
</dependency> | ||
``` | ||
|
||
- application.properties 配置本地文件保存路径 | ||
|
||
```properties | ||
ureport.debug=false | ||
ureport.disableFileProvider=false | ||
ureport.fileStoreDir=/Users/lengleng/Downloads | ||
ureport.disableHttpSessionReportCache=true | ||
``` | ||
- 访问 报表设计器 | ||
|
||
http://127.0.0.1:8080/ureport/designer | ||
|
||
## 集群使用 | ||
|
||
如上文设计好的模板是保存在服务本机的,在集群环境中需要使用统一的文件系统存储。新增依赖 | ||
|
||
```xml | ||
|
||
<dependency> | ||
<groupId>com.pig4cloud.plugin</groupId> | ||
<artifactId>oss-spring-boot-starter</artifactId> | ||
<version>0.0.3</version> | ||
</dependency> | ||
``` | ||
|
||
- 仅需配置云存储相关参数, 演示为minio | ||
|
||
``` | ||
oss.access-key=lengleng | ||
oss.secret-key=lengleng | ||
oss.bucket-name=lengleng | ||
oss.endpoint=http://minio.pig4cloud.com | ||
``` | ||
|
||
关于 [oss-spring-boot-starter ](https://github.com/pig-mesh/oss-spring-boot-starter)使用可参考,兼容所有 S3 协议的分布式文件存储系统 | ||
关于 [ureport-spring-boot-starter ](https://github.com/pig-mesh/ureport-spring-boot-starter)使用可参考,UReport2 的 spring boot 封装 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,72 @@ | ||
<?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"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>demo-ureport2</artifactId> | ||
<artifactId>demo-ureport2</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>demo-ureport2</name> | ||
<description>Demo project for Spring Boot</description> | ||
|
||
<parent> | ||
<groupId>com.xkcoding</groupId> | ||
<artifactId>spring-boot-demo</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>demo-ureport2</name> | ||
<description>Demo project for Spring Boot</description> | ||
|
||
<parent> | ||
<groupId>com.xkcoding</groupId> | ||
<artifactId>spring-boot-demo</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<java.version>1.8</java.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<finalName>demo-ureport2</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</parent> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<java.version>1.8</java.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<!--web 依赖--> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-data-jpa</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>mysql</groupId> | ||
<artifactId>mysql-connector-java</artifactId> | ||
</dependency> | ||
|
||
<!--ureport 依赖--> | ||
<dependency> | ||
<groupId>com.pig4cloud.plugin</groupId> | ||
<artifactId>ureport-spring-boot-starter</artifactId> | ||
<version>0.0.1</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<finalName>demo-ureport2</finalName> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
34 changes: 34 additions & 0 deletions
34
demo-ureport2/src/main/java/com/xkcoding/ureport2/config/InnerDatasource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.xkcoding.ureport2.config; | ||
|
||
import com.bstek.ureport.definition.datasource.BuildinDatasource; | ||
import lombok.SneakyThrows; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
|
||
import javax.sql.DataSource; | ||
import java.sql.Connection; | ||
|
||
/** | ||
* <p> | ||
* 内部数据源 | ||
* </p> | ||
* | ||
* @author yangkai.shen | ||
* @date Created in 2020-10-26 22:32 | ||
*/ | ||
@Component | ||
public class InnerDatasource implements BuildinDatasource { | ||
@Autowired | ||
private DataSource datasource; | ||
|
||
@Override | ||
public String name() { | ||
return "内部数据源"; | ||
} | ||
|
||
@SneakyThrows | ||
@Override | ||
public Connection getConnection() { | ||
return datasource.getConnection(); | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
server: | ||
port: 8080 | ||
servlet: | ||
context-path: /demo | ||
spring: | ||
datasource: | ||
url: jdbc:mysql://127.0.0.1:3306/spring-boot-demo?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=GMT%2B8 | ||
username: root | ||
password: root | ||
driver-class-name: com.mysql.cj.jdbc.Driver | ||
ureport: | ||
debug: false | ||
disableFileProvider: false | ||
disableHttpSessionReportCache: true | ||
# 单机模式,路径需要提前创建 | ||
fileStoreDir: '/Users/yangkai.shen/Desktop/ureport2' |