From a4b714b95a4ac17ad1e032e0f8823733c821d05a Mon Sep 17 00:00:00 2001
From: 若依 <yzz_ivy@163.com>
Date: Sun, 07 Aug 2022 18:47:16 +0800
Subject: [PATCH] !224 处理XSS攻击问题 Merge pull request !224 from Pcat/hotfix-3.6.1.pcat#I5IRC8
---
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/annotation/Excel.java | 57 +++++++++++++++++++++++++++++++++++++--------------------
1 files changed, 37 insertions(+), 20 deletions(-)
diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/annotation/Excel.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/annotation/Excel.java
index 975eca3..fd20df1 100644
--- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/annotation/Excel.java
+++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/annotation/Excel.java
@@ -5,6 +5,9 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.math.BigDecimal;
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
+import org.apache.poi.ss.usermodel.IndexedColors;
+import com.ruoyi.common.core.utils.poi.ExcelHandlerAdapter;
/**
* 自定义导出Excel数据注解
@@ -49,11 +52,6 @@
* BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN
*/
public int roundingMode() default BigDecimal.ROUND_HALF_EVEN;
-
- /**
- * 导出类型(0数字 1字符串)
- */
- public ColumnType cellType() default ColumnType.STRING;
/**
* 导出时在excel中每个列的高度 单位为字符
@@ -101,25 +99,44 @@
public boolean isStatistics() default false;
/**
- * 导出字段对齐方式(0:默认;1:靠左;2:居中;3:靠右)
+ * 导出类型(0数字 1字符串)
*/
- Align align() default Align.AUTO;
+ public ColumnType cellType() default ColumnType.STRING;
- public enum Align
- {
- AUTO(0), LEFT(1), CENTER(2), RIGHT(3);
- private final int value;
+ /**
+ * 导出列头背景色
+ */
+ public IndexedColors headerBackgroundColor() default IndexedColors.GREY_50_PERCENT;
- Align(int value)
- {
- this.value = value;
- }
+ /**
+ * 导出列头字体颜色
+ */
+ public IndexedColors headerColor() default IndexedColors.WHITE;
- public int value()
- {
- return this.value;
- }
- }
+ /**
+ * 导出单元格背景色
+ */
+ public IndexedColors backgroundColor() default IndexedColors.WHITE;
+
+ /**
+ * 导出单元格字体颜色
+ */
+ public IndexedColors color() default IndexedColors.BLACK;
+
+ /**
+ * 导出字段对齐方式
+ */
+ public HorizontalAlignment align() default HorizontalAlignment.CENTER;
+
+ /**
+ * 自定义数据处理器
+ */
+ public Class<?> handler() default ExcelHandlerAdapter.class;
+
+ /**
+ * 自定义数据处理器参数
+ */
+ public String[] args() default {};
/**
* 字段类型(0:导出导入;1:仅导出;2:仅导入)
--
Gitblit v1.9.3