Commit e4af8797 authored by Quxl's avatar Quxl

修改BUG

parent 64ad0b4d
...@@ -109,7 +109,8 @@ public class Util { ...@@ -109,7 +109,8 @@ public class Util {
} }
} }
} catch (Exception e) { } catch (Exception e) {
throw new ReflectException(e); e.printStackTrace();
throw new ReflectException("", e);
} }
return bean; return bean;
} }
...@@ -181,7 +182,7 @@ public class Util { ...@@ -181,7 +182,7 @@ public class Util {
* @param clz 要求转换的对象格式 * @param clz 要求转换的对象格式
* @return * @return
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings({ "unchecked", "rawtypes" })
public static <T> T objTo(Object obj, Class<T> clz) { public static <T> T objTo(Object obj, Class<T> clz) {
if(clz == String.class) { if(clz == String.class) {
return (T)String.valueOf(obj); return (T)String.valueOf(obj);
...@@ -225,6 +226,8 @@ public class Util { ...@@ -225,6 +226,8 @@ public class Util {
return (T)toBoolean(obj); return (T)toBoolean(obj);
} else if(clz == Map.class || clz == HashMap.class || clz == TreeMap.class) { } else if(clz == Map.class || clz == HashMap.class || clz == TreeMap.class) {
return (T)toMap(obj); return (T)toMap(obj);
} else if(clz.isEnum()) {
return (T) Enum.valueOf((Class<Enum>)clz, obj.toString());
} else { } else {
return (T)obj; return (T)obj;
} }
......
...@@ -245,6 +245,8 @@ public class JdbcTemplate extends org.springframework.jdbc.core.JdbcTemplate { ...@@ -245,6 +245,8 @@ public class JdbcTemplate extends org.springframework.jdbc.core.JdbcTemplate {
if(argObj instanceof java.util.Date) { if(argObj instanceof java.util.Date) {
java.util.Date argDate = (java.util.Date)argObj; java.util.Date argDate = (java.util.Date)argObj;
ps.setObject(i+1, new java.sql.Timestamp(argDate.getTime())); ps.setObject(i+1, new java.sql.Timestamp(argDate.getTime()));
} else if(argObj.getClass().isEnum()) {
ps.setObject(i+1, args[i].toString());
} else { } else {
ps.setObject(i+1, args[i]); ps.setObject(i+1, args[i]);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment