mirror of https://gitee.com/y_project/RuoYi.git
Excel支持导入Boolean型数据
parent
c0d66fffcd
commit
9d30a4652c
|
@ -279,6 +279,10 @@ public class ExcelUtil<T>
|
||||||
val = DateUtil.getJavaDate((Double) val);
|
val = DateUtil.getJavaDate((Double) val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (Boolean.TYPE == fieldType || Boolean.class == fieldType)
|
||||||
|
{
|
||||||
|
val = Convert.toBool(val, false);
|
||||||
|
}
|
||||||
if (StringUtils.isNotNull(fieldType))
|
if (StringUtils.isNotNull(fieldType))
|
||||||
{
|
{
|
||||||
Excel attr = field.getAnnotation(Excel.class);
|
Excel attr = field.getAnnotation(Excel.class);
|
||||||
|
@ -295,9 +299,6 @@ public class ExcelUtil<T>
|
||||||
{
|
{
|
||||||
val = reverseDictByExp(Convert.toStr(val), attr.dictType(), attr.separator());
|
val = reverseDictByExp(Convert.toStr(val), attr.dictType(), attr.separator());
|
||||||
}
|
}
|
||||||
if (fieldType == boolean.class && (val == null||"".equals(val))) {
|
|
||||||
val = false;
|
|
||||||
}
|
|
||||||
ReflectUtils.invokeSetter(entity, propertyName, val);
|
ReflectUtils.invokeSetter(entity, propertyName, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,8 +204,10 @@ public class ReflectUtils
|
||||||
args[i] = DateUtil.getJavaDate((Double) args[i]);
|
args[i] = DateUtil.getJavaDate((Double) args[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (cs[i] == boolean.class|| cs[i] == Boolean.class) {
|
else if (cs[i] == boolean.class|| cs[i] == Boolean.class)
|
||||||
args[i] = Convert.toBool(args[i]);}
|
{
|
||||||
|
args[i] = Convert.toBool(args[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (E) method.invoke(obj, args);
|
return (E) method.invoke(obj, args);
|
||||||
|
|
Loading…
Reference in New Issue