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 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 281 if (StringUtils.isNotNull(fieldType))
278 282 {
279 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 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 213 return (E) method.invoke(obj, args);
... ...