Commit d6d27e68 authored by Quxl's avatar Quxl

x

parent 28f9bf78
package com.egolm.common.jdbc; package com.egolm.common.jdbc;
import java.beans.MethodDescriptor;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.sql.CallableStatement; import java.sql.CallableStatement;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
...@@ -207,11 +209,14 @@ public class JdbcTemplate extends org.springframework.jdbc.core.JdbcTemplate { ...@@ -207,11 +209,14 @@ public class JdbcTemplate extends org.springframework.jdbc.core.JdbcTemplate {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
Field[] fields = obj.getClass().getDeclaredFields(); Field[] fields = obj.getClass().getDeclaredFields();
for(Field field : fields) { for(Field field : fields) {
int mod = field.getModifiers();
if(!Modifier.isStatic(mod) && !Modifier.isFinal(mod)) {
Object fieldValue = ReflexUtil.getFieldValue(field, obj); Object fieldValue = ReflexUtil.getFieldValue(field, obj);
if(fieldValue != null) { if(fieldValue != null) {
map.put(field.getName(), fieldValue); map.put(field.getName(), fieldValue);
} }
} }
}
return this.updateByColumn(iSql.getName(), iSql.getColumnPkNames(), map); return this.updateByColumn(iSql.getName(), iSql.getColumnPkNames(), map);
} else if(objMaps.size() > 1) { } else if(objMaps.size() > 1) {
throw new MustBeOneRowException(); throw new MustBeOneRowException();
......
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