From 909fd8929d7906f1dca68acc05e36e29b0b9192c Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期二, 15 十一月 2022 10:57:30 +0800
Subject: [PATCH] 2022.11.15

---
 src/main/kotlin/cn/flightfeather/supervision/business/report/BaseCols.kt |   35 ++++++++++++++++++++++++++++++++---
 1 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseCols.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseCols.kt
index ae22382..8b6f31f 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseCols.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseCols.kt
@@ -5,15 +5,31 @@
 
 /**
  * 缁熻鏁版嵁鍒楀熀绫�
+ * @param chooseIndexList 閫夋嫨闇�瑕佽緭鍑虹殑鍒楀簭鍙凤紝涓嶅~鍐欐椂琛ㄧず榛樿杈撳嚭鎵�鏈夊垪
  */
-abstract class BaseCols(){
+abstract class BaseCols(private val chooseIndexList: List<Int>){
 
     protected var heads = mutableListOf<MutableList<ExcelUtil.MyCell>>()
 
     //鐢熸垚琛ㄥご
     fun getHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> {
         heads = onHeads(dataSource)
-        return heads
+        val _heads = if (chooseIndexList.isNotEmpty()) {
+            val __heads = mutableListOf<MutableList<ExcelUtil.MyCell>>()
+            heads.forEach {head ->
+                val h = mutableListOf<ExcelUtil.MyCell>()
+                chooseIndexList.forEach {i ->
+                    if (i < head.size) {
+                        h.add(head[i])
+                    }
+                }
+                __heads.add(h)
+            }
+            __heads
+        } else {
+            heads
+        }
+        return _heads
     }
 
     abstract fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>>
@@ -27,7 +43,20 @@
 //        } else {
 //            onOneRow(rowData)
 //        }
-        return onOneRow(rowData)
+        val row = onOneRow(rowData)
+        val _row = if (chooseIndexList.isNotEmpty()) {
+            val r = mutableListOf<Any>()
+            chooseIndexList.forEach {i ->
+                if (i < row.size) {
+                    r.add(row[i])
+                }
+            }
+            r
+        } else {
+            row
+        }
+
+        return _row
     }
 
     abstract fun onOneRow(rowData: DataSource.RowData): List<Any>

--
Gitblit v1.9.3