作者 RuoYi

Excel支持导入Boolean型数据

@@ -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);
@@ -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);