Commit fd831d5a9024f46328be4f8794ac39b0072189bd

Authored by RuoYi
1 parent e83412b9

Excel支持导入Boolean型数据

ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java
@@ -274,6 +274,10 @@ public class ExcelUtil<T> @@ -274,6 +274,10 @@ public class ExcelUtil<T>
274 val = DateUtil.getJavaDate((Double) val); 274 val = DateUtil.getJavaDate((Double) val);
275 } 275 }
276 } 276 }
  277 + else if (Boolean.TYPE == fieldType || Boolean.class == fieldType)
  278 + {
  279 + val = Convert.toBool(val, false);
  280 + }
277 if (StringUtils.isNotNull(fieldType)) 281 if (StringUtils.isNotNull(fieldType))
278 { 282 {
279 Excel attr = field.getAnnotation(Excel.class); 283 Excel attr = field.getAnnotation(Excel.class);
ruoyi-common/src/main/java/com/ruoyi/common/utils/reflect/ReflectUtils.java
@@ -204,6 +204,10 @@ public class ReflectUtils @@ -204,6 +204,10 @@ public class ReflectUtils
204 args[i] = DateUtil.getJavaDate((Double) args[i]); 204 args[i] = DateUtil.getJavaDate((Double) args[i]);
205 } 205 }
206 } 206 }
  207 + else if (cs[i] == boolean.class || cs[i] == Boolean.class)
  208 + {
  209 + args[i] = Convert.toBool(args[i]);
  210 + }
207 } 211 }
208 } 212 }
209 return (E) method.invoke(obj, args); 213 return (E) method.invoke(obj, args);