From effe9fa26b86de56258755c2d9de096048f01b23 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期四, 03 七月 2025 15:37:48 +0800
Subject: [PATCH] bug修改

---
 ruoyi-system/src/main/java/com/ruoyi/system/utils/ExcelPoiUtils.java |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/utils/ExcelPoiUtils.java b/ruoyi-system/src/main/java/com/ruoyi/system/utils/ExcelPoiUtils.java
index 461e114..c8da239 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/utils/ExcelPoiUtils.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/utils/ExcelPoiUtils.java
@@ -9,6 +9,7 @@
 import cn.hutool.core.util.ReflectUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.ruoyi.system.vo.system.ProjectDeptDetailsChildVO;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.poi.ss.usermodel.Workbook;
 import org.springframework.beans.BeanUtils;
@@ -62,7 +63,16 @@
             downloadExcelEntityDynamic(response, entityList, objList, fileName, title, sheetName);
         }
     }
- 
+    public static <T> void exportExcel(HttpServletResponse response, String fileName, String title, String sheetName,
+                                       List<T> dataList, List<ProjectDeptDetailsChildVO> projectDeptDetailsChildVOS, String headerName, String headerValue) throws Exception {
+        if (CollectionUtils.isNotEmpty(dataList)) {
+            ProjectDeptDetailsChildVO dataInstance = projectDeptDetailsChildVOS.get(0);
+            List<ExcelExportEntity> entityList = buildExcelExportEntityList(dataInstance, headerName, "");
+            List<Object> objList = convertDataListToObjList(dataList, headerName,headerValue);
+            downloadExcelEntityDynamic(response, entityList, objList, fileName, title, sheetName);
+        }
+    }
+
     public static <T> void exportExcel(HttpServletResponse response, String fileName, String title, String sheetName,
                                        List<T> dataList, String headerName, String headerValue, String ignoreCol) throws Exception {
         if (CollectionUtils.isNotEmpty(dataList)) {
@@ -82,7 +92,7 @@
      * @return Excel导出实体列表
      * @throws IllegalAccessException 如果无法访问字段
      */
-    private static <T> List<ExcelExportEntity> buildExcelExportEntityList(T t, String headerName, String ignoreCol) throws IllegalAccessException {
+    public static <T> List<ExcelExportEntity> buildExcelExportEntityList(T t, String headerName, String ignoreCol) throws IllegalAccessException {
         List<ExcelExportEntity> entityList = new ArrayList<>();
         Field[] fields = t.getClass().getDeclaredFields();
         int index = 0;

--
Gitblit v1.7.1