EntityBuilder优化
This commit is contained in:
@@ -296,13 +296,19 @@ public class EntityBuilder<T> {
|
|||||||
obj = creator.create();
|
obj = creator.create();
|
||||||
for (String sqlCol : sqlColumns) {
|
for (String sqlCol : sqlColumns) {
|
||||||
Attribute<T, Serializable> attr = attrs.get(sqlCol);
|
Attribute<T, Serializable> attr = attrs.get(sqlCol);
|
||||||
|
boolean sqlFlag = false;
|
||||||
if (attr == null && sqlCol.indexOf('_') > -1) {
|
if (attr == null && sqlCol.indexOf('_') > -1) {
|
||||||
attr = attrs.get(snakeCaseColumn(sqlCol));
|
attr = attrs.get(snakeCaseColumn(sqlCol));
|
||||||
|
sqlFlag = true;
|
||||||
}
|
}
|
||||||
if (attr != null) { //兼容返回的字段不存在类中
|
if (attr != null) { //兼容返回的字段不存在类中
|
||||||
|
if (sqlFlag) {
|
||||||
|
attr.set(obj, getFieldValue(row, sqlCol));
|
||||||
|
} else {
|
||||||
attr.set(obj, getFieldValue(attr, row, 0));
|
attr.set(obj, getFieldValue(attr, row, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Object[] cps = new Object[this.constructorParameters.length];
|
Object[] cps = new Object[this.constructorParameters.length];
|
||||||
for (int i = 0; i < this.constructorAttributes.length; i++) {
|
for (int i = 0; i < this.constructorAttributes.length; i++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user