From a0e3cb11ab8d8b601f9d70dfc7ab1e87b26ba8f0 Mon Sep 17 00:00:00 2001
From: liuhongfeng <291117974@qq.com>
Date: Mon, 20 Nov 2023 23:07:12 +0800
Subject: [PATCH 1/4] =?UTF-8?q?=E3=80=90=E6=96=B0=E5=A2=9E=E3=80=91ureport?=
 =?UTF-8?q?2=20=E9=9B=86=E6=88=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 sql/mysql/Ureport.sql                         |  55 +++++++
 yudao-dependencies/pom.xml                    |   9 ++
 .../report/enums/ErrorCodeConstants.java      |   2 +
 .../yudao-module-report-biz/pom.xml           |  10 ++
 .../admin/ureport/UreportFileController.java  |  95 ++++++++++++
 .../ureport/vo/UreportFilePageReqVO.java      |  31 ++++
 .../admin/ureport/vo/UreportFileRespVO.java   |  36 +++++
 .../ureport/vo/UreportFileSaveReqVO.java      |  30 ++++
 .../dal/dataobject/ureport/UreportFileDO.java |  47 ++++++
 .../dal/mysql/ureport/UreportFileMapper.java  |  29 ++++
 .../config/SecurityConfiguration.java         |   1 +
 .../ureport/config/UreportConfig.java         |  29 ++++
 .../ureport/config/UreportDataSource.java     |  48 ++++++
 .../provider/UreportDatabaseProvider.java     | 129 ++++++++++++++++
 .../provider/UreportFileReportProvider.java   | 119 +++++++++++++++
 .../service/ureport/UreportFileService.java   |  55 +++++++
 .../ureport/UreportFileServiceImpl.java       |  74 +++++++++
 .../mapper/ureport/UreportFileMapper.xml      |  12 ++
 .../src/main/resources/ureport.properties     |   4 +
 .../ureport/UreportFileServiceImplTest.java   | 142 ++++++++++++++++++
 .../src/test/resources/sql/clean.sql          |   1 +
 .../src/test/resources/sql/create_tables.sql  |  13 ++
 .../src/main/resources/application-local.yaml |  13 ++
 23 files changed, 984 insertions(+)
 create mode 100644 sql/mysql/Ureport.sql
 create mode 100644 yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/admin/ureport/UreportFileController.java
 create mode 100644 yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/admin/ureport/vo/UreportFilePageReqVO.java
 create mode 100644 yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/admin/ureport/vo/UreportFileRespVO.java
 create mode 100644 yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/admin/ureport/vo/UreportFileSaveReqVO.java
 create mode 100644 yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/dal/dataobject/ureport/UreportFileDO.java
 create mode 100644 yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/dal/mysql/ureport/UreportFileMapper.java
 create mode 100644 yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/config/UreportConfig.java
 create mode 100644 yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/config/UreportDataSource.java
 create mode 100644 yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/provider/UreportDatabaseProvider.java
 create mode 100644 yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/provider/UreportFileReportProvider.java
 create mode 100644 yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/service/ureport/UreportFileService.java
 create mode 100644 yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/service/ureport/UreportFileServiceImpl.java
 create mode 100644 yudao-module-report/yudao-module-report-biz/src/main/resources/mapper/ureport/UreportFileMapper.xml
 create mode 100644 yudao-module-report/yudao-module-report-biz/src/main/resources/ureport.properties
 create mode 100644 yudao-module-report/yudao-module-report-biz/src/test/java/cn/iocoder/yudao/module/report/service/ureport/UreportFileServiceImplTest.java

diff --git a/sql/mysql/Ureport.sql b/sql/mysql/Ureport.sql
new file mode 100644
index 000000000..86687372c
--- /dev/null
+++ b/sql/mysql/Ureport.sql
@@ -0,0 +1,55 @@
+-- 菜单 SQL
+INSERT INTO system_menu(
+    name, permission, type, sort, parent_id,
+    path, icon, component, status, component_name
+)
+VALUES (
+           'Ureport2报表管理', '', 2, 0, 1281,
+           'ureport-file', '', 'report/ureport/index', 0, 'UreportFile'
+       );
+
+-- 按钮父菜单ID
+-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
+SELECT @parentId := LAST_INSERT_ID();
+
+-- 按钮 SQL
+INSERT INTO system_menu(
+    name, permission, type, sort, parent_id,
+    path, icon, component, status
+)
+VALUES (
+           'Ureport2报表查询', 'report:ureport-file:query', 3, 1, @parentId,
+           '', '', '', 0
+       );
+INSERT INTO system_menu(
+    name, permission, type, sort, parent_id,
+    path, icon, component, status
+)
+VALUES (
+           'Ureport2报表创建', 'report:ureport-file:create', 3, 2, @parentId,
+           '', '', '', 0
+       );
+INSERT INTO system_menu(
+    name, permission, type, sort, parent_id,
+    path, icon, component, status
+)
+VALUES (
+           'Ureport2报表更新', 'report:ureport-file:update', 3, 3, @parentId,
+           '', '', '', 0
+       );
+INSERT INTO system_menu(
+    name, permission, type, sort, parent_id,
+    path, icon, component, status
+)
+VALUES (
+           'Ureport2报表删除', 'report:ureport-file:delete', 3, 4, @parentId,
+           '', '', '', 0
+       );
+INSERT INTO system_menu(
+    name, permission, type, sort, parent_id,
+    path, icon, component, status
+)
+VALUES (
+           'Ureport2报表导出', 'report:ureport-file:export', 3, 5, @parentId,
+           '', '', '', 0
+       );
diff --git a/yudao-dependencies/pom.xml b/yudao-dependencies/pom.xml
index dbd6e2f3c..faff2ac29 100644
--- a/yudao-dependencies/pom.xml
+++ b/yudao-dependencies/pom.xml
@@ -74,6 +74,7 @@
         <jimureport.version>1.6.1</jimureport.version>
         <xercesImpl.version>2.12.2</xercesImpl.version>
         <weixin-java.version>4.5.0</weixin-java.version>
+        <ureport2.version>2.2.9</ureport2.version>
     </properties>
 
     <dependencyManagement>
@@ -651,6 +652,14 @@
                 <artifactId>spring-boot-starter-websocket</artifactId>
                 <version>${spring.boot.version}</version>
             </dependency>
+
+            <!--ureport2 报表-->
+            <dependency>
+                <groupId>com.bstek.ureport</groupId>
+                <artifactId>ureport2-console</artifactId>
+                <version>${ureport2.version}</version>
+            </dependency>
+
         </dependencies>
     </dependencyManagement>
 
diff --git a/yudao-module-report/yudao-module-report-api/src/main/java/cn/iocoder/yudao/module/report/enums/ErrorCodeConstants.java b/yudao-module-report/yudao-module-report-api/src/main/java/cn/iocoder/yudao/module/report/enums/ErrorCodeConstants.java
index 16eff831c..39edb84be 100644
--- a/yudao-module-report/yudao-module-report-api/src/main/java/cn/iocoder/yudao/module/report/enums/ErrorCodeConstants.java
+++ b/yudao-module-report/yudao-module-report-api/src/main/java/cn/iocoder/yudao/module/report/enums/ErrorCodeConstants.java
@@ -12,4 +12,6 @@ public interface ErrorCodeConstants {
     // ========== AUTH 模块 1-003-000-000 ==========
     ErrorCode GO_VIEW_PROJECT_NOT_EXISTS = new ErrorCode(1_003_000_000, "GoView 项目不存在");
 
+    ErrorCode UREPORT_FILE_NOT_EXISTS = new ErrorCode(1_003_001_000, "打印文件不存在,请检查Ureport报表文件");
+    ErrorCode UREPORT_FILE_EXISTS = new ErrorCode(1_003_001_001, "报表名字已存在,请修改后再保存");
 }
diff --git a/yudao-module-report/yudao-module-report-biz/pom.xml b/yudao-module-report/yudao-module-report-biz/pom.xml
index 9308fc386..83461f5fe 100644
--- a/yudao-module-report/yudao-module-report-biz/pom.xml
+++ b/yudao-module-report/yudao-module-report-biz/pom.xml
@@ -74,5 +74,15 @@
             <artifactId>xercesImpl</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>com.bstek.ureport</groupId>
+            <artifactId>ureport2-console</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>cn.iocoder.boot</groupId>
+            <artifactId>yudao-spring-boot-starter-excel</artifactId>
+        </dependency>
+
     </dependencies>
 </project>
diff --git a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/admin/ureport/UreportFileController.java b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/admin/ureport/UreportFileController.java
new file mode 100644
index 000000000..0ea93f22e
--- /dev/null
+++ b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/admin/ureport/UreportFileController.java
@@ -0,0 +1,95 @@
+package cn.iocoder.yudao.module.report.controller.admin.ureport;
+
+import org.springframework.web.bind.annotation.*;
+import javax.annotation.Resource;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.security.access.prepost.PreAuthorize;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.Operation;
+
+import javax.validation.constraints.*;
+import javax.validation.*;
+import javax.servlet.http.*;
+import java.util.*;
+import java.io.IOException;
+
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
+
+import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
+import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
+
+import cn.iocoder.yudao.module.report.controller.admin.ureport.vo.*;
+import cn.iocoder.yudao.module.report.dal.dataobject.ureport.UreportFileDO;
+import cn.iocoder.yudao.module.report.service.ureport.UreportFileService;
+
+@Tag(name = "管理后台 - Ureport2报表")
+@RestController
+@RequestMapping("/report/ureport-file")
+@Validated
+public class UreportFileController {
+
+    @Resource
+    private UreportFileService ureportFileService;
+
+    @PostMapping("/create")
+    @Operation(summary = "创建Ureport2报表")
+    @PreAuthorize("@ss.hasPermission('report:ureport-file:create')")
+    public CommonResult<Long> createUreportFile(@Valid @RequestBody UreportFileSaveReqVO createReqVO) {
+        return success(ureportFileService.createUreportFile(createReqVO));
+    }
+
+    @PutMapping("/update")
+    @Operation(summary = "更新Ureport2报表")
+    @PreAuthorize("@ss.hasPermission('report:ureport-file:update')")
+    public CommonResult<Boolean> updateUreportFile(@Valid @RequestBody UreportFileSaveReqVO updateReqVO) {
+        ureportFileService.updateUreportFile(updateReqVO);
+        return success(true);
+    }
+
+    @DeleteMapping("/delete")
+    @Operation(summary = "删除Ureport2报表")
+    @Parameter(name = "id", description = "编号", required = true)
+    @PreAuthorize("@ss.hasPermission('report:ureport-file:delete')")
+    public CommonResult<Boolean> deleteUreportFile(@RequestParam("id") Long id) {
+        ureportFileService.deleteUreportFile(id);
+        return success(true);
+    }
+
+    @GetMapping("/get")
+    @Operation(summary = "获得Ureport2报表")
+    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('report:ureport-file:query')")
+    public CommonResult<UreportFileRespVO> getUreportFile(@RequestParam("id") Long id) {
+        UreportFileDO ureportFile = ureportFileService.getUreportFile(id);
+        return success(BeanUtils.toBean(ureportFile, UreportFileRespVO.class));
+    }
+
+    @GetMapping("/page")
+    @Operation(summary = "获得Ureport2报表分页")
+    @PreAuthorize("@ss.hasPermission('report:ureport-file:query')")
+    public CommonResult<PageResult<UreportFileRespVO>> getUreportFilePage(@Valid UreportFilePageReqVO pageReqVO) {
+        PageResult<UreportFileDO> pageResult = ureportFileService.getUreportFilePage(pageReqVO);
+        return success(BeanUtils.toBean(pageResult, UreportFileRespVO.class));
+    }
+
+    @GetMapping("/export-excel")
+    @Operation(summary = "导出Ureport2报表 Excel")
+    @PreAuthorize("@ss.hasPermission('report:ureport-file:export')")
+    @OperateLog(type = EXPORT)
+    public void exportUreportFileExcel(@Valid UreportFilePageReqVO pageReqVO,
+              HttpServletResponse response) throws IOException {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        List<UreportFileDO> list = ureportFileService.getUreportFilePage(pageReqVO).getList();
+        // 导出 Excel
+        ExcelUtils.write(response, "Ureport2报表.xls", "数据", UreportFileRespVO.class,
+                        BeanUtils.toBean(list, UreportFileRespVO.class));
+    }
+
+}
\ No newline at end of file
diff --git a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/admin/ureport/vo/UreportFilePageReqVO.java b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/admin/ureport/vo/UreportFilePageReqVO.java
new file mode 100644
index 000000000..558b50fbf
--- /dev/null
+++ b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/admin/ureport/vo/UreportFilePageReqVO.java
@@ -0,0 +1,31 @@
+package cn.iocoder.yudao.module.report.controller.admin.ureport.vo;
+
+import lombok.*;
+import java.util.*;
+import io.swagger.v3.oas.annotations.media.Schema;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.time.LocalDateTime;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - Ureport2报表分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class UreportFilePageReqVO extends PageParam {
+
+    @Schema(description = "文件名称", example = "赵六")
+    private String fileName;
+
+    @Schema(description = "状态", example = "1")
+    private Integer status;
+
+    @Schema(description = "备注", example = "随便")
+    private String remark;
+
+    @Schema(description = "创建时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] createTime;
+
+}
\ No newline at end of file
diff --git a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/admin/ureport/vo/UreportFileRespVO.java b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/admin/ureport/vo/UreportFileRespVO.java
new file mode 100644
index 000000000..739369a26
--- /dev/null
+++ b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/admin/ureport/vo/UreportFileRespVO.java
@@ -0,0 +1,36 @@
+package cn.iocoder.yudao.module.report.controller.admin.ureport.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import java.util.*;
+import java.util.*;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.time.LocalDateTime;
+import com.alibaba.excel.annotation.*;
+
+@Schema(description = "管理后台 - Ureport2报表 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class UreportFileRespVO {
+
+    @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "9948")
+    @ExcelProperty("ID")
+    private Long id;
+
+    @Schema(description = "文件名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
+    @ExcelProperty("文件名称")
+    private String fileName;
+
+    @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+    @ExcelProperty("状态")
+    private Integer status;
+
+    @Schema(description = "备注", example = "随便")
+    @ExcelProperty("备注")
+    private String remark;
+
+    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("创建时间")
+    private LocalDateTime createTime;
+
+}
\ No newline at end of file
diff --git a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/admin/ureport/vo/UreportFileSaveReqVO.java b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/admin/ureport/vo/UreportFileSaveReqVO.java
new file mode 100644
index 000000000..fc8baa33b
--- /dev/null
+++ b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/controller/admin/ureport/vo/UreportFileSaveReqVO.java
@@ -0,0 +1,30 @@
+package cn.iocoder.yudao.module.report.controller.admin.ureport.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import java.util.*;
+import javax.validation.constraints.*;
+import java.util.*;
+
+@Schema(description = "管理后台 - Ureport2报表新增/修改 Request VO")
+@Data
+public class UreportFileSaveReqVO {
+
+    @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "9948")
+    private Long id;
+
+    @Schema(description = "文件名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
+    @NotEmpty(message = "文件名称不能为空")
+    private String fileName;
+
+    @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+    @NotNull(message = "状态不能为空")
+    private Integer status;
+
+    @Schema(description = "文件内容")
+    private String fileContent;
+
+    @Schema(description = "备注", example = "随便")
+    private String remark;
+
+}
diff --git a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/dal/dataobject/ureport/UreportFileDO.java b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/dal/dataobject/ureport/UreportFileDO.java
new file mode 100644
index 000000000..c9872f8ca
--- /dev/null
+++ b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/dal/dataobject/ureport/UreportFileDO.java
@@ -0,0 +1,47 @@
+package cn.iocoder.yudao.module.report.dal.dataobject.ureport;
+
+import lombok.*;
+import java.util.*;
+import java.time.LocalDateTime;
+import java.time.LocalDateTime;
+import com.baomidou.mybatisplus.annotation.*;
+import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
+
+/**
+ * Ureport2报表 DO
+ *
+ * @author 芋道源码
+ */
+@TableName("ureport_file")
+@KeySequence("ureport_file_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class UreportFileDO extends BaseDO {
+
+    /**
+     * ID
+     */
+    @TableId
+    private Long id;
+    /**
+     * 文件名称
+     */
+    private String fileName;
+    /**
+     * 状态
+     */
+    private Integer status;
+    /**
+     * 文件内容
+     */
+    private byte[] fileContent;
+    /**
+     * 备注
+     */
+    private String remark;
+
+}
diff --git a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/dal/mysql/ureport/UreportFileMapper.java b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/dal/mysql/ureport/UreportFileMapper.java
new file mode 100644
index 000000000..618b80414
--- /dev/null
+++ b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/dal/mysql/ureport/UreportFileMapper.java
@@ -0,0 +1,29 @@
+package cn.iocoder.yudao.module.report.dal.mysql.ureport;
+
+import java.util.*;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.module.report.dal.dataobject.ureport.UreportFileDO;
+import org.apache.ibatis.annotations.Mapper;
+import cn.iocoder.yudao.module.report.controller.admin.ureport.vo.*;
+
+/**
+ * Ureport2报表 Mapper
+ *
+ * @author 芋道源码
+ */
+@Mapper
+public interface UreportFileMapper extends BaseMapperX<UreportFileDO> {
+
+    default PageResult<UreportFileDO> selectPage(UreportFilePageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<UreportFileDO>()
+                .likeIfPresent(UreportFileDO::getFileName, reqVO.getFileName())
+                .eqIfPresent(UreportFileDO::getStatus, reqVO.getStatus())
+                .eqIfPresent(UreportFileDO::getRemark, reqVO.getRemark())
+                .betweenIfPresent(UreportFileDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(UreportFileDO::getId));
+    }
+
+}
\ No newline at end of file
diff --git a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/security/config/SecurityConfiguration.java b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/security/config/SecurityConfiguration.java
index 5b73cd274..82ded0d23 100644
--- a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/security/config/SecurityConfiguration.java
+++ b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/security/config/SecurityConfiguration.java
@@ -20,6 +20,7 @@ public class SecurityConfiguration {
             public void customize(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry) {
                 //积木报表
                 registry.antMatchers("/jmreport/**").permitAll();
+                registry.antMatchers("/ureport/**").permitAll();
             }
 
         };
diff --git a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/config/UreportConfig.java b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/config/UreportConfig.java
new file mode 100644
index 000000000..47841e101
--- /dev/null
+++ b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/config/UreportConfig.java
@@ -0,0 +1,29 @@
+package cn.iocoder.yudao.module.report.framework.ureport.config;
+
+import com.bstek.ureport.console.UReportServlet;
+import org.springframework.boot.web.servlet.ServletRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.ImportResource;
+import org.springframework.context.annotation.PropertySource;
+
+import javax.servlet.Servlet;
+
+/**
+ * Ureport 配置类
+ * 加载ureport对应的xml配置文件
+ */
+@PropertySource(value = {"classpath:ureport.properties"})
+@ImportResource("classpath:ureport-console-context.xml")
+@Configuration
+public class UreportConfig{
+
+    /**
+     * ureport2报表Servlet配置
+     */
+    @Bean
+    public ServletRegistrationBean<Servlet> ureport2Servlet(){
+        return new ServletRegistrationBean<>(new UReportServlet(), "/ureport/*");
+    }
+
+}
diff --git a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/config/UreportDataSource.java b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/config/UreportDataSource.java
new file mode 100644
index 000000000..30c0be2df
--- /dev/null
+++ b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/config/UreportDataSource.java
@@ -0,0 +1,48 @@
+package cn.iocoder.yudao.module.report.framework.ureport.config;
+
+import com.bstek.ureport.definition.datasource.BuildinDatasource;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * ureport内置数据源
+ */
+@Slf4j
+@Component
+public class UreportDataSource implements BuildinDatasource {
+
+	private static final String NAME = "本机数据源";
+
+	@Resource
+	private DataSource dataSource;
+
+	/**
+	 * 数据源名称
+	 *
+	 **/
+	@Override
+	public String name() {
+		return NAME;
+	}
+
+	/**
+	 * * 获取连接
+	 *
+	 **/
+	@Override
+	public Connection getConnection() {
+		try {
+			return dataSource.getConnection();
+		} catch (SQLException e) {
+			log.error("Ureport 数据源 获取连接失败!");
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+}
diff --git a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/provider/UreportDatabaseProvider.java b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/provider/UreportDatabaseProvider.java
new file mode 100644
index 000000000..f0949e7e7
--- /dev/null
+++ b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/provider/UreportDatabaseProvider.java
@@ -0,0 +1,129 @@
+/*
+package cn.iocoder.yudao.module.report.framework.ureport.provider;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.iocoder.yudao.module.report.dal.dataobject.ureport.UreportFileDO;
+import cn.iocoder.yudao.module.report.dal.mysql.ureport.UreportFileMapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.bstek.ureport.provider.report.ReportFile;
+import com.bstek.ureport.provider.report.ReportProvider;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.time.ZonedDateTime;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.iocoder.yudao.module.report.enums.ErrorCodeConstants.UREPORT_FILE_EXISTS;
+import static cn.iocoder.yudao.module.report.enums.ErrorCodeConstants.UREPORT_FILE_NOT_EXISTS;
+
+*/
+/**
+ * 提供数据库的存储方式
+ * @author 赤焰
+ *//*
+
+@Slf4j
+@Component
+@ConfigurationProperties(prefix = "ureport.provider.database")
+public class UreportDatabaseProvider implements ReportProvider{
+
+    private static final String NAME = "数据库存储系统";
+
+    private String prefix = "db:";
+
+    private boolean disabled;
+
+    @Resource
+    private UreportFileMapper ureportFileMapper;
+
+    @Override
+    public InputStream loadReport(String file) {
+        LambdaQueryWrapper<UreportFileDO> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(UreportFileDO::getFileName, getCorrectName(file));
+        UreportFileDO reportDo = ureportFileMapper.selectOne(queryWrapper);
+        if (reportDo == null) {
+            throw exception(UREPORT_FILE_NOT_EXISTS);
+        }
+        byte[] content = reportDo.getFileContent();
+        return new ByteArrayInputStream(content);
+    }
+
+    @Override
+    public void deleteReport(String file) {
+        LambdaQueryWrapper<UreportFileDO> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(UreportFileDO::getFileName, getCorrectName(file));
+        ureportFileMapper.delete(queryWrapper);
+    }
+
+    @Override
+    public List<ReportFile> getReportFiles() {
+        LambdaQueryWrapper<UreportFileDO> reportFileQueryWrapper = new LambdaQueryWrapper<>();
+        List<UreportFileDO> list = ureportFileMapper.selectList(reportFileQueryWrapper);
+        List<ReportFile> reportList = new ArrayList<>();
+        if(CollUtil.isEmpty(list)){
+            return reportList;
+        }
+        for (UreportFileDO reportFile : list) {
+            LocalDateTime updateTime = reportFile.getUpdateTime();
+            ZonedDateTime zdt = updateTime.atZone(ZoneId.systemDefault());
+            Date date = Date.from(zdt.toInstant());
+            reportList.add(new ReportFile(reportFile.getFileName(),date));
+        }
+        return reportList;
+
+    }
+
+    @Override
+    public void saveReport(String file, String content) {
+        file = getCorrectName(file);
+        LambdaQueryWrapper<UreportFileDO> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(UreportFileDO::getFileName, file);
+        Long count = ureportFileMapper.selectCount(queryWrapper);
+        if(count>1){
+            throw exception(UREPORT_FILE_EXISTS);
+        }
+        UreportFileDO ureportFileDO = ureportFileMapper.selectOne(queryWrapper);
+        if (ureportFileDO == null) {
+            ureportFileDO = new UreportFileDO();
+            ureportFileDO.setFileName(file);
+            ureportFileDO.setFileContent(content.getBytes());
+            ureportFileMapper.insert(ureportFileDO);
+        } else {
+            ureportFileDO.setFileContent(content.getBytes());
+            ureportFileMapper.update(ureportFileDO, queryWrapper);
+        }
+    }
+
+    @Override
+    public String getName() {
+        return NAME;
+    }
+
+    @Override
+    public boolean disabled() {
+        return disabled;
+    }
+
+    @Override
+    public String getPrefix() {
+        return prefix;
+    }
+
+    private String getCorrectName(String name) {
+        if (name.startsWith(prefix)) {
+            name = name.substring(prefix.length(), name.length());
+        }
+        return name;
+    }
+}
+*/
diff --git a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/provider/UreportFileReportProvider.java b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/provider/UreportFileReportProvider.java
new file mode 100644
index 000000000..504ba19e8
--- /dev/null
+++ b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/provider/UreportFileReportProvider.java
@@ -0,0 +1,119 @@
+/*
+package cn.iocoder.yudao.module.report.framework.ureport.provider;
+
+import com.bstek.ureport.exception.ReportException;
+import com.bstek.ureport.provider.report.ReportFile;
+import com.bstek.ureport.provider.report.ReportProvider;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.io.IOUtils;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Objects;
+
+*/
+/**
+ * 自定义文件存储,可接入oss等
+ * @author 赤焰
+ *//*
+
+@Slf4j
+@Component
+@ConfigurationProperties(prefix = "ureport.provider.file")
+public class UreportFileReportProvider implements ReportProvider{
+
+    private String prefix="reportFile:";
+    private String fileStoreDir;
+    private boolean disabled;
+
+    @Override
+    public InputStream loadReport(String file) {
+        if(file.startsWith(prefix)){
+            file=file.substring(prefix.length(),file.length());
+        }
+        String fullPath=fileStoreDir+"/"+file;
+        try {
+            return new FileInputStream(fullPath);
+        } catch (FileNotFoundException e) {
+            throw new ReportException(e);
+        }
+    }
+
+    @Override
+    public void deleteReport(String file) {
+        if(file.startsWith(prefix)){
+            file=file.substring(prefix.length(),file.length());
+        }
+        String fullPath=fileStoreDir+"/"+file;
+        File f=new File(fullPath);
+        if(f.exists()){
+            f.delete();
+        }
+    }
+
+    @Override
+    public List<ReportFile> getReportFiles() {
+        File file=new File(fileStoreDir);
+        List<ReportFile> list= new ArrayList<>();
+        for(File f: Objects.requireNonNull(file.listFiles())){
+            Calendar calendar=Calendar.getInstance();
+            calendar.setTimeInMillis(f.lastModified());
+            list.add(new ReportFile(f.getName(),calendar.getTime()));
+        }
+        list.sort((f1, f2) -> f2.getUpdateDate().compareTo(f1.getUpdateDate()));
+        return list;
+    }
+
+    @Override
+    public String getName() {
+        return "文件存储系统";
+    }
+
+    @Override
+    public void saveReport(String file,String content) {
+        if(file.startsWith(prefix)){
+            file=file.substring(prefix.length(),file.length());
+        }
+        String fullPath=fileStoreDir+"/"+file;
+        FileOutputStream outStream=null;
+        try{
+            outStream=new FileOutputStream(new File(fullPath));
+            IOUtils.write(content, outStream,"utf-8");
+        }catch(Exception ex){
+            throw new ReportException(ex);
+        }finally{
+            if(outStream!=null){
+                try {
+                    outStream.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+
+    }
+
+    @Override
+    public boolean disabled() {
+        return disabled;
+    }
+
+    public void setDisabled(boolean disabled) {
+        this.disabled = disabled;
+    }
+
+    public void setFileStoreDir(String fileStoreDir) {
+        this.fileStoreDir = fileStoreDir;
+    }
+
+    @Override
+    public String getPrefix() {
+        return prefix;
+    }
+
+}
+*/
diff --git a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/service/ureport/UreportFileService.java b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/service/ureport/UreportFileService.java
new file mode 100644
index 000000000..a7be5c1c6
--- /dev/null
+++ b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/service/ureport/UreportFileService.java
@@ -0,0 +1,55 @@
+package cn.iocoder.yudao.module.report.service.ureport;
+
+import java.util.*;
+import javax.validation.*;
+import cn.iocoder.yudao.module.report.controller.admin.ureport.vo.*;
+import cn.iocoder.yudao.module.report.dal.dataobject.ureport.UreportFileDO;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+
+/**
+ * Ureport2报表 Service 接口
+ *
+ * @author 芋道源码
+ */
+public interface UreportFileService {
+
+    /**
+     * 创建Ureport2报表
+     *
+     * @param createReqVO 创建信息
+     * @return 编号
+     */
+    Long createUreportFile(@Valid UreportFileSaveReqVO createReqVO);
+
+    /**
+     * 更新Ureport2报表
+     *
+     * @param updateReqVO 更新信息
+     */
+    void updateUreportFile(@Valid UreportFileSaveReqVO updateReqVO);
+
+    /**
+     * 删除Ureport2报表
+     *
+     * @param id 编号
+     */
+    void deleteUreportFile(Long id);
+
+    /**
+     * 获得Ureport2报表
+     *
+     * @param id 编号
+     * @return Ureport2报表
+     */
+    UreportFileDO getUreportFile(Long id);
+
+    /**
+     * 获得Ureport2报表分页
+     *
+     * @param pageReqVO 分页查询
+     * @return Ureport2报表分页
+     */
+    PageResult<UreportFileDO> getUreportFilePage(UreportFilePageReqVO pageReqVO);
+
+}
\ No newline at end of file
diff --git a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/service/ureport/UreportFileServiceImpl.java b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/service/ureport/UreportFileServiceImpl.java
new file mode 100644
index 000000000..3a6608f83
--- /dev/null
+++ b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/service/ureport/UreportFileServiceImpl.java
@@ -0,0 +1,74 @@
+package cn.iocoder.yudao.module.report.service.ureport;
+
+import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+import cn.iocoder.yudao.module.report.controller.admin.ureport.vo.*;
+import cn.iocoder.yudao.module.report.dal.dataobject.ureport.UreportFileDO;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+
+import cn.iocoder.yudao.module.report.dal.mysql.ureport.UreportFileMapper;
+
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.iocoder.yudao.module.report.enums.ErrorCodeConstants.*;
+
+/**
+ * Ureport2报表 Service 实现类
+ *
+ * @author 芋道源码
+ */
+@Service
+@Validated
+public class UreportFileServiceImpl implements UreportFileService {
+
+    @Resource
+    private UreportFileMapper ureportFileMapper;
+
+    @Override
+    public Long createUreportFile(UreportFileSaveReqVO createReqVO) {
+        // 插入
+        UreportFileDO ureportFile = BeanUtils.toBean(createReqVO, UreportFileDO.class);
+        ureportFileMapper.insert(ureportFile);
+        // 返回
+        return ureportFile.getId();
+    }
+
+    @Override
+    public void updateUreportFile(UreportFileSaveReqVO updateReqVO) {
+        // 校验存在
+        validateUreportFileExists(updateReqVO.getId());
+        // 更新
+        UreportFileDO updateObj = BeanUtils.toBean(updateReqVO, UreportFileDO.class);
+        ureportFileMapper.updateById(updateObj);
+    }
+
+    @Override
+    public void deleteUreportFile(Long id) {
+        // 校验存在
+        validateUreportFileExists(id);
+        // 删除
+        ureportFileMapper.deleteById(id);
+    }
+
+    private void validateUreportFileExists(Long id) {
+        if (ureportFileMapper.selectById(id) == null) {
+            throw exception(UREPORT_FILE_NOT_EXISTS);
+        }
+    }
+
+    @Override
+    public UreportFileDO getUreportFile(Long id) {
+        return ureportFileMapper.selectById(id);
+    }
+
+    @Override
+    public PageResult<UreportFileDO> getUreportFilePage(UreportFilePageReqVO pageReqVO) {
+        return ureportFileMapper.selectPage(pageReqVO);
+    }
+
+}
\ No newline at end of file
diff --git a/yudao-module-report/yudao-module-report-biz/src/main/resources/mapper/ureport/UreportFileMapper.xml b/yudao-module-report/yudao-module-report-biz/src/main/resources/mapper/ureport/UreportFileMapper.xml
new file mode 100644
index 000000000..0a948a604
--- /dev/null
+++ b/yudao-module-report/yudao-module-report-biz/src/main/resources/mapper/ureport/UreportFileMapper.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.iocoder.yudao.module.report.dal.mysql.ureport.UreportFileMapper">
+
+    <!--
+        一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
+        无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
+        代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
+        文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
+     -->
+
+</mapper>
\ No newline at end of file
diff --git a/yudao-module-report/yudao-module-report-biz/src/main/resources/ureport.properties b/yudao-module-report/yudao-module-report-biz/src/main/resources/ureport.properties
new file mode 100644
index 000000000..c84e00dc1
--- /dev/null
+++ b/yudao-module-report/yudao-module-report-biz/src/main/resources/ureport.properties
@@ -0,0 +1,4 @@
+ureport.disableHttpSessionReportCache=false
+ureport.disableFileProvider=false
+ureport.fileStoreDir=D:\\ureport\\files
+ureport.debug=true
diff --git a/yudao-module-report/yudao-module-report-biz/src/test/java/cn/iocoder/yudao/module/report/service/ureport/UreportFileServiceImplTest.java b/yudao-module-report/yudao-module-report-biz/src/test/java/cn/iocoder/yudao/module/report/service/ureport/UreportFileServiceImplTest.java
new file mode 100644
index 000000000..b9bc1ac6e
--- /dev/null
+++ b/yudao-module-report/yudao-module-report-biz/src/test/java/cn/iocoder/yudao/module/report/service/ureport/UreportFileServiceImplTest.java
@@ -0,0 +1,142 @@
+package cn.iocoder.yudao.module.report.service.ureport;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.springframework.boot.test.mock.mockito.MockBean;
+
+import javax.annotation.Resource;
+
+import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
+
+import cn.iocoder.yudao.module.report.controller.admin.ureport.vo.*;
+import cn.iocoder.yudao.module.report.dal.dataobject.ureport.UreportFileDO;
+import cn.iocoder.yudao.module.report.dal.mysql.ureport.UreportFileMapper;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+
+import javax.annotation.Resource;
+import org.springframework.context.annotation.Import;
+import java.util.*;
+import java.time.LocalDateTime;
+
+import static cn.hutool.core.util.RandomUtil.*;
+import static cn.iocoder.yudao.module.report.enums.ErrorCodeConstants.*;
+import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
+import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
+import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
+import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
+import static org.junit.jupiter.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+/**
+ * {@link UreportFileServiceImpl} 的单元测试类
+ *
+ * @author 芋道源码
+ */
+@Import(UreportFileServiceImpl.class)
+public class UreportFileServiceImplTest extends BaseDbUnitTest {
+
+    @Resource
+    private UreportFileServiceImpl ureportFileService;
+
+    @Resource
+    private UreportFileMapper ureportFileMapper;
+
+    @Test
+    public void testCreateUreportFile_success() {
+        // 准备参数
+        UreportFileSaveReqVO createReqVO = randomPojo(UreportFileSaveReqVO.class).setId(null);
+
+        // 调用
+        Long ureportFileId = ureportFileService.createUreportFile(createReqVO);
+        // 断言
+        assertNotNull(ureportFileId);
+        // 校验记录的属性是否正确
+        UreportFileDO ureportFile = ureportFileMapper.selectById(ureportFileId);
+        assertPojoEquals(createReqVO, ureportFile, "id");
+    }
+
+    @Test
+    public void testUpdateUreportFile_success() {
+        // mock 数据
+        UreportFileDO dbUreportFile = randomPojo(UreportFileDO.class);
+        ureportFileMapper.insert(dbUreportFile);// @Sql: 先插入出一条存在的数据
+        // 准备参数
+        UreportFileSaveReqVO updateReqVO = randomPojo(UreportFileSaveReqVO.class, o -> {
+            o.setId(dbUreportFile.getId()); // 设置更新的 ID
+        });
+
+        // 调用
+        ureportFileService.updateUreportFile(updateReqVO);
+        // 校验是否更新正确
+        UreportFileDO ureportFile = ureportFileMapper.selectById(updateReqVO.getId()); // 获取最新的
+        assertPojoEquals(updateReqVO, ureportFile);
+    }
+
+    @Test
+    public void testUpdateUreportFile_notExists() {
+        // 准备参数
+        UreportFileSaveReqVO updateReqVO = randomPojo(UreportFileSaveReqVO.class);
+
+        // 调用, 并断言异常
+        assertServiceException(() -> ureportFileService.updateUreportFile(updateReqVO), UREPORT_FILE_NOT_EXISTS);
+    }
+
+    @Test
+    public void testDeleteUreportFile_success() {
+        // mock 数据
+        UreportFileDO dbUreportFile = randomPojo(UreportFileDO.class);
+        ureportFileMapper.insert(dbUreportFile);// @Sql: 先插入出一条存在的数据
+        // 准备参数
+        Long id = dbUreportFile.getId();
+
+        // 调用
+        ureportFileService.deleteUreportFile(id);
+       // 校验数据不存在了
+       assertNull(ureportFileMapper.selectById(id));
+    }
+
+    @Test
+    public void testDeleteUreportFile_notExists() {
+        // 准备参数
+        Long id = randomLongId();
+
+        // 调用, 并断言异常
+        assertServiceException(() -> ureportFileService.deleteUreportFile(id), UREPORT_FILE_NOT_EXISTS);
+    }
+
+    @Test
+    @Disabled  // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
+    public void testGetUreportFilePage() {
+       // mock 数据
+       UreportFileDO dbUreportFile = randomPojo(UreportFileDO.class, o -> { // 等会查询到
+           o.setFileName(null);
+           o.setStatus(null);
+           o.setRemark(null);
+           o.setCreateTime(null);
+       });
+       ureportFileMapper.insert(dbUreportFile);
+       // 测试 fileName 不匹配
+       ureportFileMapper.insert(cloneIgnoreId(dbUreportFile, o -> o.setFileName(null)));
+       // 测试 status 不匹配
+       ureportFileMapper.insert(cloneIgnoreId(dbUreportFile, o -> o.setStatus(null)));
+       // 测试 remark 不匹配
+       ureportFileMapper.insert(cloneIgnoreId(dbUreportFile, o -> o.setRemark(null)));
+       // 测试 createTime 不匹配
+       ureportFileMapper.insert(cloneIgnoreId(dbUreportFile, o -> o.setCreateTime(null)));
+       // 准备参数
+       UreportFilePageReqVO reqVO = new UreportFilePageReqVO();
+       reqVO.setFileName(null);
+       reqVO.setStatus(null);
+       reqVO.setRemark(null);
+       reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
+
+       // 调用
+       PageResult<UreportFileDO> pageResult = ureportFileService.getUreportFilePage(reqVO);
+       // 断言
+       assertEquals(1, pageResult.getTotal());
+       assertEquals(1, pageResult.getList().size());
+       assertPojoEquals(dbUreportFile, pageResult.getList().get(0));
+    }
+
+}
\ No newline at end of file
diff --git a/yudao-module-report/yudao-module-report-biz/src/test/resources/sql/clean.sql b/yudao-module-report/yudao-module-report-biz/src/test/resources/sql/clean.sql
index 4a0268afc..6ffc3c6ac 100644
--- a/yudao-module-report/yudao-module-report-biz/src/test/resources/sql/clean.sql
+++ b/yudao-module-report/yudao-module-report-biz/src/test/resources/sql/clean.sql
@@ -1 +1,2 @@
 DELETE FROM "report_go_view_project";
+DELETE FROM "ureport_file";
diff --git a/yudao-module-report/yudao-module-report-biz/src/test/resources/sql/create_tables.sql b/yudao-module-report/yudao-module-report-biz/src/test/resources/sql/create_tables.sql
index a77397fea..1c2dab730 100644
--- a/yudao-module-report/yudao-module-report-biz/src/test/resources/sql/create_tables.sql
+++ b/yudao-module-report/yudao-module-report-biz/src/test/resources/sql/create_tables.sql
@@ -12,3 +12,16 @@ CREATE TABLE IF NOT EXISTS "report_go_view_project" (
     "deleted" bit NOT NULL DEFAULT FALSE,
     PRIMARY KEY ("id")
 ) COMMENT 'GoView 项目表';
+CREATE TABLE IF NOT EXISTS "ureport_file" (
+      "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
+      "file_name" varchar NOT NULL,
+      "status" int NOT NULL,
+      "file_content" varchar,
+      "remark" varchar,
+      "creator" varchar DEFAULT '',
+      "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+      "updater" varchar DEFAULT '',
+      "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+      "deleted" bit NOT NULL DEFAULT FALSE,
+      PRIMARY KEY ("id")
+) COMMENT 'Ureport2报表';
diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml
index f15b0cf8d..a51630caa 100644
--- a/yudao-server/src/main/resources/application-local.yaml
+++ b/yudao-server/src/main/resources/application-local.yaml
@@ -264,3 +264,16 @@ justauth:
     prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE::
     timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟
 
+#ureport配置
+#ureport:
+#  disableHttpSessionReportCache: true #是否禁用
+#  disableFileProvider: true #是否禁用
+#  debug: true
+#  fileStoreDir: D://ureport//files
+#  provider:
+#    database:
+#       disabled: true
+#    file:
+#       disabled: true
+
+

From b5a667cb9c9dc841cc05f84d25635ea6ec3c810b Mon Sep 17 00:00:00 2001
From: liuhongfeng <291117974@qq.com>
Date: Mon, 20 Nov 2023 23:31:21 +0800
Subject: [PATCH 2/4] =?UTF-8?q?=E3=80=90=E6=96=B0=E5=A2=9E=E3=80=91ureport?=
 =?UTF-8?q?2=20=E9=9B=86=E6=88=90=E7=9A=84SQL=E8=AF=AD=E5=8F=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 sql/mysql/Ureport.sql | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/sql/mysql/Ureport.sql b/sql/mysql/Ureport.sql
index 86687372c..b1c11afc0 100644
--- a/sql/mysql/Ureport.sql
+++ b/sql/mysql/Ureport.sql
@@ -53,3 +53,20 @@ VALUES (
            'Ureport2报表导出', 'report:ureport-file:export', 3, 5, @parentId,
            '', '', '', 0
        );
+
+
+DROP TABLE IF EXISTS `ureport_file`;
+CREATE TABLE `ureport_file`  (
+     `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
+     `file_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '文件名称',
+     `status` tinyint(4) NOT NULL COMMENT '状态',
+     `file_content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT '文件内容',
+     `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注',
+     `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
+     `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+     `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
+     `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
+     `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
+     `tenant_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '租户编号',
+     PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'Ureport2报表' ROW_FORMAT = Dynamic;

From 770086ac5be79108d1375805d3933831847a35b2 Mon Sep 17 00:00:00 2001
From: liuhongfeng <291117974@qq.com>
Date: Wed, 22 Nov 2023 22:13:05 +0800
Subject: [PATCH 3/4] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91ureport?=
 =?UTF-8?q?2=20=E9=9B=86=E6=88=90=E7=9A=84SQL=E8=AF=AD=E5=8F=A5=EF=BC=8C?=
 =?UTF-8?q?=E5=B9=B6=E9=80=82=E9=85=8D=E6=95=B0=E6=8D=AE=E5=BA=93=E5=AD=98?=
 =?UTF-8?q?=E5=82=A8=E6=96=B9=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ...tConfig.java => UreportConfiguration.java} | 12 ++--
 .../ureport/config/UreportDataSource.java     |  2 +-
 .../provider/UreportDatabaseProvider.java     | 61 +++++++++----------
 .../service/ureport/UreportFileService.java   | 45 +++++++++++---
 .../ureport/UreportFileServiceImpl.java       | 54 ++++++++++++----
 .../src/main/resources/ureport.properties     |  6 +-
 .../src/main/resources/application.yaml       |  7 +++
 7 files changed, 126 insertions(+), 61 deletions(-)
 rename yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/config/{UreportConfig.java => UreportConfiguration.java} (77%)

diff --git a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/config/UreportConfig.java b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/config/UreportConfiguration.java
similarity index 77%
rename from yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/config/UreportConfig.java
rename to yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/config/UreportConfiguration.java
index 47841e101..6e3093f9e 100644
--- a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/config/UreportConfig.java
+++ b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/config/UreportConfiguration.java
@@ -12,17 +12,15 @@ import javax.servlet.Servlet;
 /**
  * Ureport 配置类
  * 加载ureport对应的xml配置文件
+ * @author  赤焰
  */
-@PropertySource(value = {"classpath:ureport.properties"})
-@ImportResource("classpath:ureport-console-context.xml")
 @Configuration
-public class UreportConfig{
+@ImportResource({"classpath:ureport-console-context.xml"})
+@PropertySource(value = {"classpath:ureport.properties"})
+public class UreportConfiguration {
 
-    /**
-     * ureport2报表Servlet配置
-     */
     @Bean
-    public ServletRegistrationBean<Servlet> ureport2Servlet(){
+    public ServletRegistrationBean<Servlet> registrationBean() {
         return new ServletRegistrationBean<>(new UReportServlet(), "/ureport/*");
     }
 
diff --git a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/config/UreportDataSource.java b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/config/UreportDataSource.java
index 30c0be2df..9aeddfc72 100644
--- a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/config/UreportDataSource.java
+++ b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/config/UreportDataSource.java
@@ -16,7 +16,7 @@ import java.sql.SQLException;
 @Component
 public class UreportDataSource implements BuildinDatasource {
 
-	private static final String NAME = "本机数据源";
+	private static final String NAME = "UreportDataSource";
 
 	@Resource
 	private DataSource dataSource;
diff --git a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/provider/UreportDatabaseProvider.java b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/provider/UreportDatabaseProvider.java
index f0949e7e7..ddaf7c7b0 100644
--- a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/provider/UreportDatabaseProvider.java
+++ b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/framework/ureport/provider/UreportDatabaseProvider.java
@@ -1,9 +1,11 @@
-/*
 package cn.iocoder.yudao.module.report.framework.ureport.provider;
 
+import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
+import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
+import cn.iocoder.yudao.module.report.controller.admin.ureport.vo.UreportFileSaveReqVO;
 import cn.iocoder.yudao.module.report.dal.dataobject.ureport.UreportFileDO;
-import cn.iocoder.yudao.module.report.dal.mysql.ureport.UreportFileMapper;
+import cn.iocoder.yudao.module.report.service.ureport.UreportFileService;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.bstek.ureport.provider.report.ReportFile;
 import com.bstek.ureport.provider.report.ReportProvider;
@@ -26,49 +28,43 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
 import static cn.iocoder.yudao.module.report.enums.ErrorCodeConstants.UREPORT_FILE_EXISTS;
 import static cn.iocoder.yudao.module.report.enums.ErrorCodeConstants.UREPORT_FILE_NOT_EXISTS;
 
-*/
 /**
  * 提供数据库的存储方式
  * @author 赤焰
- *//*
-
+ */
 @Slf4j
+@Setter
 @Component
 @ConfigurationProperties(prefix = "ureport.provider.database")
 public class UreportDatabaseProvider implements ReportProvider{
 
-    private static final String NAME = "数据库存储系统";
+    private static final String NAME = "mysql-provider";
 
-    private String prefix = "db:";
-
-    private boolean disabled;
+    private String prefix = "mysql:";
 
+    private boolean disabled = false;
     @Resource
-    private UreportFileMapper ureportFileMapper;
+    private UreportFileService ureportFileService;
 
     @Override
     public InputStream loadReport(String file) {
-        LambdaQueryWrapper<UreportFileDO> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(UreportFileDO::getFileName, getCorrectName(file));
-        UreportFileDO reportDo = ureportFileMapper.selectOne(queryWrapper);
-        if (reportDo == null) {
+        Long reportDo = ureportFileService.checkExistByName(getCorrectName(file));
+        if (reportDo <=0) {
             throw exception(UREPORT_FILE_NOT_EXISTS);
         }
-        byte[] content = reportDo.getFileContent();
+        UreportFileDO ureportFileDO = ureportFileService.queryUreportFileDoByName(getCorrectName(file));
+        byte[] content = ureportFileDO.getFileContent();
         return new ByteArrayInputStream(content);
     }
 
     @Override
     public void deleteReport(String file) {
-        LambdaQueryWrapper<UreportFileDO> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(UreportFileDO::getFileName, getCorrectName(file));
-        ureportFileMapper.delete(queryWrapper);
+        ureportFileService.deleteReportFileByName(getCorrectName(file));
     }
 
     @Override
     public List<ReportFile> getReportFiles() {
-        LambdaQueryWrapper<UreportFileDO> reportFileQueryWrapper = new LambdaQueryWrapper<>();
-        List<UreportFileDO> list = ureportFileMapper.selectList(reportFileQueryWrapper);
+        List<UreportFileDO> list = ureportFileService.queryReportFileList();
         List<ReportFile> reportList = new ArrayList<>();
         if(CollUtil.isEmpty(list)){
             return reportList;
@@ -88,19 +84,23 @@ public class UreportDatabaseProvider implements ReportProvider{
         file = getCorrectName(file);
         LambdaQueryWrapper<UreportFileDO> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(UreportFileDO::getFileName, file);
-        Long count = ureportFileMapper.selectCount(queryWrapper);
+        Long count = ureportFileService.checkExistByName(file);
         if(count>1){
             throw exception(UREPORT_FILE_EXISTS);
         }
-        UreportFileDO ureportFileDO = ureportFileMapper.selectOne(queryWrapper);
+        UreportFileDO ureportFileDO = ureportFileService.queryUreportFileDoByName(file);
+        UreportFileSaveReqVO saveReqVO = new UreportFileSaveReqVO();
         if (ureportFileDO == null) {
-            ureportFileDO = new UreportFileDO();
-            ureportFileDO.setFileName(file);
-            ureportFileDO.setFileContent(content.getBytes());
-            ureportFileMapper.insert(ureportFileDO);
+            saveReqVO.setFileName(file);
+            saveReqVO.setFileContent(content);
+            saveReqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
+            ureportFileService.createUreportFile(saveReqVO);
         } else {
-            ureportFileDO.setFileContent(content.getBytes());
-            ureportFileMapper.update(ureportFileDO, queryWrapper);
+            saveReqVO.setId(ureportFileDO.getId());
+            saveReqVO.setFileName(file);
+            saveReqVO.setFileContent(content);
+            saveReqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
+            ureportFileService.updateUreportFile(saveReqVO);
         }
     }
 
@@ -120,10 +120,9 @@ public class UreportDatabaseProvider implements ReportProvider{
     }
 
     private String getCorrectName(String name) {
-        if (name.startsWith(prefix)) {
-            name = name.substring(prefix.length(), name.length());
+        if (name.startsWith(getPrefix())) {
+            name = name.substring(getPrefix().length());
         }
         return name;
     }
 }
-*/
diff --git a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/service/ureport/UreportFileService.java b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/service/ureport/UreportFileService.java
index a7be5c1c6..ed26f187e 100644
--- a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/service/ureport/UreportFileService.java
+++ b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/service/ureport/UreportFileService.java
@@ -1,18 +1,19 @@
 package cn.iocoder.yudao.module.report.service.ureport;
 
-import java.util.*;
-import javax.validation.*;
-import cn.iocoder.yudao.module.report.controller.admin.ureport.vo.*;
-import cn.iocoder.yudao.module.report.dal.dataobject.ureport.UreportFileDO;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import cn.iocoder.yudao.module.report.controller.admin.ureport.vo.UreportFilePageReqVO;
+import cn.iocoder.yudao.module.report.controller.admin.ureport.vo.UreportFileSaveReqVO;
+import cn.iocoder.yudao.module.report.dal.dataobject.ureport.UreportFileDO;
+
+import javax.validation.Valid;
+import java.util.List;
 
 /**
  * Ureport2报表 Service 接口
  *
  * @author 芋道源码
  */
-public interface UreportFileService {
+public interface UreportFileService  {
 
     /**
      * 创建Ureport2报表
@@ -52,4 +53,34 @@ public interface UreportFileService {
      */
     PageResult<UreportFileDO> getUreportFilePage(UreportFilePageReqVO pageReqVO);
 
-}
\ No newline at end of file
+
+    /**
+     *  根据报表名称检查报表是否存在
+     * @param name 报表名称
+     * @return
+     */
+    Long checkExistByName(String name);
+
+    /**
+     *  根据报表名称查询报表
+     * @param name 报表名称
+     * @return
+     */
+     UreportFileDO queryUreportFileDoByName(String name);
+
+
+    /**
+     * 查询全部报表
+     * @return
+     */
+    List<UreportFileDO> queryReportFileList();
+
+
+    /**
+     * 根据报表名称删除报表
+     * @param name
+     * @return
+     */
+     int deleteReportFileByName(String name);
+
+}
diff --git a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/service/ureport/UreportFileServiceImpl.java b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/service/ureport/UreportFileServiceImpl.java
index 3a6608f83..ccb47efd1 100644
--- a/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/service/ureport/UreportFileServiceImpl.java
+++ b/yudao-module-report/yudao-module-report-biz/src/main/java/cn/iocoder/yudao/module/report/service/ureport/UreportFileServiceImpl.java
@@ -1,21 +1,21 @@
 package cn.iocoder.yudao.module.report.service.ureport;
 
-import org.springframework.stereotype.Service;
-import javax.annotation.Resource;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.*;
-import cn.iocoder.yudao.module.report.controller.admin.ureport.vo.*;
-import cn.iocoder.yudao.module.report.dal.dataobject.ureport.UreportFileDO;
+import cn.hutool.core.collection.CollectionUtil;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
-
+import cn.iocoder.yudao.module.report.controller.admin.ureport.vo.UreportFilePageReqVO;
+import cn.iocoder.yudao.module.report.controller.admin.ureport.vo.UreportFileSaveReqVO;
+import cn.iocoder.yudao.module.report.dal.dataobject.ureport.UreportFileDO;
 import cn.iocoder.yudao.module.report.dal.mysql.ureport.UreportFileMapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import javax.annotation.Resource;
+import java.util.List;
 
 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
-import static cn.iocoder.yudao.module.report.enums.ErrorCodeConstants.*;
+import static cn.iocoder.yudao.module.report.enums.ErrorCodeConstants.UREPORT_FILE_NOT_EXISTS;
 
 /**
  * Ureport2报表 Service 实现类
@@ -71,4 +71,34 @@ public class UreportFileServiceImpl implements UreportFileService {
         return ureportFileMapper.selectPage(pageReqVO);
     }
 
-}
\ No newline at end of file
+    @Override
+    public Long checkExistByName(String name) {
+        LambdaQueryWrapper<UreportFileDO> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(UreportFileDO::getFileName,name);
+        return ureportFileMapper.selectCount(queryWrapper);
+    }
+
+    @Override
+    public UreportFileDO queryUreportFileDoByName(String name) {
+        LambdaQueryWrapper<UreportFileDO> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(UreportFileDO::getFileName,name);
+        List<UreportFileDO> list = ureportFileMapper.selectList(queryWrapper);
+        if(CollectionUtil.isNotEmpty(list)){
+            return list.get(0);
+        }
+        return null;
+    }
+
+    @Override
+    public List<UreportFileDO> queryReportFileList() {
+        LambdaQueryWrapper<UreportFileDO> queryWrapper = new LambdaQueryWrapper<>();
+        return ureportFileMapper.selectList(queryWrapper);
+    }
+
+    @Override
+    public int deleteReportFileByName(String name) {
+        LambdaQueryWrapper<UreportFileDO> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(UreportFileDO::getFileName,name);
+        return ureportFileMapper.delete(queryWrapper);
+    }
+}
diff --git a/yudao-module-report/yudao-module-report-biz/src/main/resources/ureport.properties b/yudao-module-report/yudao-module-report-biz/src/main/resources/ureport.properties
index c84e00dc1..a4f9313db 100644
--- a/yudao-module-report/yudao-module-report-biz/src/main/resources/ureport.properties
+++ b/yudao-module-report/yudao-module-report-biz/src/main/resources/ureport.properties
@@ -1,4 +1,4 @@
-ureport.disableHttpSessionReportCache=false
-ureport.disableFileProvider=false
-ureport.fileStoreDir=D:\\ureport\\files
+ureport.disableHttpSessionReportCache=true
+ureport.disableFileProvider=true
+ureport.fileStoreDir=/WEB-INF/ureportfiles
 ureport.debug=true
diff --git a/yudao-server/src/main/resources/application.yaml b/yudao-server/src/main/resources/application.yaml
index a51fa9bbb..d5c8e7e47 100644
--- a/yudao-server/src/main/resources/application.yaml
+++ b/yudao-server/src/main/resources/application.yaml
@@ -182,6 +182,7 @@ yudao:
       - /admin-api/system/sms/callback/* # 短信回调接口,无法带上租户编号
       - /admin-api/pay/notify/** # 支付回调通知,不携带租户编号
       - /jmreport/* # 积木报表,无法携带租户编号
+      - /ureport/* # ureport报表,无法携带租户编号
       - /admin-api/mp/open/** # 微信公众号开放平台,微信回调接口,无法携带租户编号
     ignore-tables:
       - system_tenant
@@ -220,6 +221,7 @@ yudao:
       - jimu_report_link
       - jimu_report_map
       - jimu_report_share
+      - ureport_file
       - rep_demo_dxtj
       - rep_demo_employee
       - rep_demo_gongsi
@@ -253,3 +255,8 @@ debug: false
 minidao :
   base-package: org.jeecg.modules.jmreport.desreport.dao*
   db-type: mysql
+#ureport配置
+ureport:
+  provider:
+    database:
+        disabled: false

From 05369a36a3f7a67d1a93142ce4185c0f8a4bdbec Mon Sep 17 00:00:00 2001
From: liuhongfeng <291117974@qq.com>
Date: Wed, 22 Nov 2023 22:15:08 +0800
Subject: [PATCH 4/4] =?UTF-8?q?=E3=80=90=E6=96=B0=E5=A2=9E=E3=80=91ureport?=
 =?UTF-8?q?2=E8=8F=9C=E5=8D=95=EF=BC=8C=E5=88=9D=E5=A7=8B=E5=8C=96?=
 =?UTF-8?q?=E6=95=B0=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 sql/mysql/Ureport.sql | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sql/mysql/Ureport.sql b/sql/mysql/Ureport.sql
index b1c11afc0..f75efb874 100644
--- a/sql/mysql/Ureport.sql
+++ b/sql/mysql/Ureport.sql
@@ -4,7 +4,7 @@ INSERT INTO system_menu(
     path, icon, component, status, component_name
 )
 VALUES (
-           'Ureport2报表管理', '', 2, 0, 1281,
+           'Ureport2报表', '', 2, 0, 1281,
            'ureport-file', '', 'report/ureport/index', 0, 'UreportFile'
        );
 
@@ -55,6 +55,7 @@ VALUES (
        );
 
 
+-- 创建数据库表
 DROP TABLE IF EXISTS `ureport_file`;
 CREATE TABLE `ureport_file`  (
      `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
@@ -70,3 +71,7 @@ CREATE TABLE `ureport_file`  (
      `tenant_id` bigint(20) NOT NULL DEFAULT 0 COMMENT '租户编号',
      PRIMARY KEY (`id`) USING BTREE
 ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'Ureport2报表' ROW_FORMAT = Dynamic;
+
+
+-- 插入测试报表
+INSERT INTO `ureport_file` (`id`, `file_name`, `status`, `file_content`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (7, '角色对应的用户列表.ureport.xml', 0, '<?xml version=\"1.0\" encoding=\"UTF-8\"?><ureport><cell expand=\"None\" name=\"A1\" row=\"1\" col=\"1\"><cell-style font-size=\"10\" font-family=\"黑体\" bold=\"true\" align=\"center\" valign=\"middle\"><left-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><right-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><top-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><bottom-border width=\"1\" style=\"solid\" color=\"0,0,0\"/></cell-style><simple-value><![CDATA[角色名称]]></simple-value></cell><cell expand=\"None\" name=\"B1\" row=\"1\" col=\"2\"><cell-style font-size=\"10\" font-family=\"黑体\" bold=\"true\" align=\"center\" valign=\"middle\"><left-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><right-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><top-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><bottom-border width=\"1\" style=\"solid\" color=\"0,0,0\"/></cell-style><simple-value><![CDATA[角色编码]]></simple-value></cell><cell expand=\"None\" name=\"C1\" row=\"1\" col=\"3\"><cell-style font-size=\"10\" font-family=\"黑体\" bold=\"true\" align=\"center\" valign=\"middle\"><left-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><right-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><top-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><bottom-border width=\"1\" style=\"solid\" color=\"0,0,0\"/></cell-style><simple-value><![CDATA[昵称]]></simple-value></cell><cell expand=\"None\" name=\"D1\" row=\"1\" col=\"4\"><cell-style font-size=\"10\" font-family=\"黑体\" bold=\"true\" align=\"center\" valign=\"middle\"><left-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><right-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><top-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><bottom-border width=\"1\" style=\"solid\" color=\"0,0,0\"/></cell-style><simple-value><![CDATA[邮箱]]></simple-value></cell><cell expand=\"None\" name=\"E1\" row=\"1\" col=\"5\"><cell-style font-size=\"9\" forecolor=\"0,0,0\" font-family=\"黑体\" bold=\"true\" align=\"center\" valign=\"middle\"><left-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><right-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><top-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><bottom-border width=\"1\" style=\"solid\" color=\"0,0,0\"/></cell-style><simple-value><![CDATA[手机]]></simple-value></cell><cell expand=\"None\" name=\"F1\" row=\"1\" col=\"6\"><cell-style font-size=\"9\" forecolor=\"0,0,0\" font-family=\"宋体\" align=\"center\" valign=\"middle\"></cell-style><simple-value><![CDATA[]]></simple-value></cell><cell expand=\"Down\" name=\"A2\" row=\"2\" col=\"1\"><cell-style font-size=\"10\" font-family=\"黑体\" align=\"center\" valign=\"middle\"><left-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><right-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><top-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><bottom-border width=\"1\" style=\"solid\" color=\"0,0,0\"/></cell-style><dataset-value dataset-name=\"sys_role\" aggregate=\"group\" property=\"role_name\" order=\"none\" mapping-type=\"simple\"></dataset-value></cell><cell expand=\"Down\" name=\"B2\" row=\"2\" col=\"2\"><cell-style font-size=\"10\" font-family=\"黑体\" align=\"center\" valign=\"middle\"><left-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><right-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><top-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><bottom-border width=\"1\" style=\"solid\" color=\"0,0,0\"/></cell-style><dataset-value dataset-name=\"sys_role\" aggregate=\"group\" property=\"role_code\" order=\"none\" mapping-type=\"simple\"></dataset-value></cell><cell expand=\"Down\" name=\"C2\" row=\"2\" col=\"3\"><cell-style font-size=\"10\" font-family=\"黑体\" align=\"center\" valign=\"middle\"><left-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><right-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><top-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><bottom-border width=\"1\" style=\"solid\" color=\"0,0,0\"/></cell-style><dataset-value dataset-name=\"sys_role\" aggregate=\"group\" property=\"nickname\" order=\"none\" mapping-type=\"simple\"></dataset-value></cell><cell expand=\"Down\" name=\"D2\" row=\"2\" col=\"4\"><cell-style font-size=\"10\" font-family=\"黑体\" align=\"center\" valign=\"middle\"><left-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><right-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><top-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><bottom-border width=\"1\" style=\"solid\" color=\"0,0,0\"/></cell-style><dataset-value dataset-name=\"sys_role\" aggregate=\"group\" property=\"email\" order=\"none\" mapping-type=\"simple\"></dataset-value></cell><cell expand=\"Down\" name=\"E2\" row=\"2\" col=\"5\"><cell-style font-size=\"9\" forecolor=\"0,0,0\" font-family=\"黑体\" align=\"center\" valign=\"middle\"><left-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><right-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><top-border width=\"1\" style=\"solid\" color=\"0,0,0\"/><bottom-border width=\"1\" style=\"solid\" color=\"0,0,0\"/></cell-style><dataset-value dataset-name=\"sys_role\" aggregate=\"group\" property=\"mobile\" order=\"none\" mapping-type=\"simple\"></dataset-value></cell><cell expand=\"None\" name=\"F2\" row=\"2\" col=\"6\"><cell-style font-size=\"9\" forecolor=\"0,0,0\" font-family=\"宋体\" align=\"center\" valign=\"middle\"></cell-style><simple-value><![CDATA[]]></simple-value></cell><cell expand=\"None\" name=\"A3\" row=\"3\" col=\"1\"><cell-style font-size=\"10\" align=\"center\" valign=\"middle\"></cell-style><simple-value><![CDATA[]]></simple-value></cell><cell expand=\"None\" name=\"B3\" row=\"3\" col=\"2\"><cell-style font-size=\"10\" align=\"center\" valign=\"middle\"></cell-style><simple-value><![CDATA[]]></simple-value></cell><cell expand=\"None\" name=\"C3\" row=\"3\" col=\"3\"><cell-style font-size=\"10\" align=\"center\" valign=\"middle\"></cell-style><simple-value><![CDATA[]]></simple-value></cell><cell expand=\"None\" name=\"D3\" row=\"3\" col=\"4\"><cell-style font-size=\"10\" align=\"center\" valign=\"middle\"></cell-style><simple-value><![CDATA[]]></simple-value></cell><cell expand=\"None\" name=\"E3\" row=\"3\" col=\"5\"><cell-style font-size=\"9\" forecolor=\"0,0,0\" font-family=\"宋体\" align=\"center\" valign=\"middle\"></cell-style><simple-value><![CDATA[]]></simple-value></cell><cell expand=\"None\" name=\"F3\" row=\"3\" col=\"6\"><cell-style font-size=\"9\" forecolor=\"0,0,0\" font-family=\"宋体\" align=\"center\" valign=\"middle\"></cell-style><simple-value><![CDATA[]]></simple-value></cell><row row-number=\"1\" height=\"18\"/><row row-number=\"2\" height=\"18\"/><row row-number=\"3\" height=\"18\"/><column col-number=\"1\" width=\"80\"/><column col-number=\"2\" width=\"80\"/><column col-number=\"3\" width=\"80\"/><column col-number=\"4\" width=\"80\"/><column col-number=\"5\" width=\"74\"/><column col-number=\"6\" width=\"74\"/><datasource name=\"UreportDataSource\" type=\"buildin\"><dataset name=\"sys_role\" type=\"sql\"><sql><![CDATA[SELECT sr.name as role_name ,sr.code as role_code,su.username ,su.nickname ,su.email,su.mobile \nFROM system_role sr\nLEFT JOIN system_user_role sur ON sr.id = sur.role_id\nLEFT JOIN system_users su ON sur.user_id = su.id]]></sql><field name=\"role_name\"/><field name=\"role_code\"/><field name=\"username\"/><field name=\"nickname\"/><field name=\"email\"/><field name=\"mobile\"/></dataset></datasource><paper type=\"A4\" left-margin=\"90\" right-margin=\"90\"\n    top-margin=\"72\" bottom-margin=\"72\" paging-mode=\"fitpage\" fixrows=\"0\"\n    width=\"595\" height=\"842\" orientation=\"portrait\" html-report-align=\"left\" bg-image=\"\" html-interval-refresh-value=\"0\" column-enabled=\"false\"></paper></ureport>', NULL, NULL, '2023-11-22 22:02:44', NULL, '2023-11-22 22:06:51', b'0', 0);