Springboot 集成积木报表(jimuReport)

Springboot 集成积木报表(jimuReport)

搭建maven项目

引入积木报表所需pom依赖(jimureport所需的,mybatis-plus所需3以上)

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.6.RELEASE</version>
    </parent>

    <dependencies>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-freemarker -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-freemarker</artifactId>
        </dependency>


        <!--<dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            &lt;!&ndash;<version>3.0-gamma</version>&ndash;&gt;
            <version>2.3.1</version>
        </dependency>-->

        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.4.1</version>
        </dependency>

        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
            <version>3.2.1</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.alibaba/druid -->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
            <version>1.1.10</version>
        </dependency>

        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.75</version>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>4.1.2</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>4.1.2</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/cn.hutool/hutool-core -->
        <dependency>
            <groupId>cn.hutool</groupId>
            <artifactId>hutool-all</artifactId>
            <version>5.5.2</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.11</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/commons-collections/commons-collections -->
        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <version>3.2.2</version>
        </dependency>

    </dependencies>

引入 jimureport 依赖包

jar依赖

<dependency>
  <groupId>com.jimureport</groupId>
  <artifactId>spring-boot-starter-jimureport</artifactId>
  <version>1.1-beta</version>
</dependency>

同时需要配置jeecg私服地址

<repositories>
  <repository>
    <id>aliyun</id>
    <name>aliyun Repository</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    <snapshots>
      <enabled>false</enabled>
    </snapshots>
  </repository>
  <repository>
    <id>jeecg</id>
    <name>jeecg Repository</name>
    <url>http://maven.jeecg.org/nexus/content/repositories/jeecg</url>
    <snapshots>
      <enabled>false</enabled>
    </snapshots>
  </repository>
</repositories>

增加SpringBoot配置属性

#jeecg专用配置
jeecg :
  # 本地:local\Minio:minio\阿里云:alioss
  uploadType: local
  path :
    #文件上传根目录 设置
    upload: /Desktop/report
    #webapp文件路径
    webapp: D://opt//webapp
  shiro:
    excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/** #阿里云oss存储配置 oss: endpoint: oss-cn-beijing.aliyuncs.com accessKey: ?? secretKey: ?? bucketName: jeecgos staticDomain: ?? # ElasticSearch 6设置 elasticsearch: cluster-name: jeecg-ES cluster-nodes: 127.0.0.1:9200 check-enabled: false # 表单设计器配置 desform: # 主题颜色(仅支持 16进制颜色代码) theme-color: "#1890ff" # 文件、图片上传方式,可选项:qiniu(七牛云)、system(跟随系统配置) upload-type: system # 在线预览文件服务器地址配置 file-view-domain: 127.0.0.1:8012 # minio文件上传 minio: minio_url: http://minio.jeecg.com minio_name: ?? minio_pass: ?? bucketName: otatest #大屏报表参数设置 jmreport: mode: dev #是否需要校验token is_verify_token: false #必须校验方法 verify_methods: remove,delete,save,add,update #Wps在线文档 wps: domain: https://wwo.wps.cn/office/ appid: ?? appsecret: ?? #xxl-job配置 xxljob: enabled: false adminAddresses: http://127.0.0.1:9080/xxl-job-admin appname: ${spring.application.name} accessToken: '' address: 127.0.0.1:30007 ip: 127.0.0.1 port: 30007 logPath: logs/jeecg/job/jobhandler/ logRetentionDays: 30 #自定义路由配置 yml nacos database route: config: data-id: jeecg-gateway-router group: DEFAULT_GROUP data-type: yml #分布式锁配置 redisson: address: 127.0.0.1:6379 password: type: STANDALONE enabled: true 

配置数据库相关配置

spring:
  datasource:
    dynamic:
      primary: master
      strict: false
      datasource:
        master:
          driver-class-name: com.mysql.cj.jdbc.Driver
          url: jdbc:mysql://localhost:3306/jeecg-boot?useUnicode=true&characterEncoding=utf8
          username: root
          password: 密码
          type: com.alibaba.druid.pool.DruidDataSource


mybatis-plus:
  mapper-locations: classpath:org/jeecg/modules/jmreport/desreport/mapper/xml/*Mapper.xml #实体扫描,多个package用逗号或者分号分隔 typeAliasesPackage: com.org.scrooged.user.entity #typeEnumsPackage: cn.org.scrooged.entity.enums global-config: #主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID",ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID"; id-type: 3 #字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断" field-strategy: 2 #驼峰下划线转换 db-column-underline: true #数据库大写下划线转换 #capital-mode: true #逻辑删除配置 #mybatis-plus.global-config.sql-injector=com.baomidou.mybatisplus.mapper.LogicSqlInjector #sql-injector: com.baomidou.mybatisplus.mapper.LogicSqlInjector #最好使用自定义bean注入 logic-delete-value: 0 logic-not-delete-value: 1 #刷新mapper 调试神器 refresh-mapper: true # 原生配置 configuration: map-underscore-to-camel-case: true cache-enabled: false log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #打印sql语句,调试用 

启动类添加扫描包

@MapperScan(basePackages = {
   "org.jeecg.modules.jmreport.desreport.mapper"})
@SpringBootApplication(scanBasePackages = {
   "org.jeecg.modules.jmreport"})

执行sql脚本

执行相关脚本,具体见官网相关
添加链接描述

执行结果

http://localhost:8080/jmreport/list