EntityInfo优化
This commit is contained in:
@@ -216,7 +216,7 @@ public abstract class AbstractDataSource extends AbstractService implements Data
|
|||||||
* @return 对象
|
* @return 对象
|
||||||
*/
|
*/
|
||||||
protected <T> T getEntityValue(EntityInfo<T> info, final SelectColumn sels, final EntityInfo.DataResultSetRow row) {
|
protected <T> T getEntityValue(EntityInfo<T> info, final SelectColumn sels, final EntityInfo.DataResultSetRow row) {
|
||||||
return sels == null ? info.getBuilder().getFullEntityValue(row) : info.getBuilder().getEntityValue(sels, row);
|
return info.getBuilder().getEntityValue(sels, row);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import org.redkale.util.*;
|
|||||||
*
|
*
|
||||||
* @author zhangjx
|
* @author zhangjx
|
||||||
*/
|
*/
|
||||||
public class ColumnValue {
|
public class ColumnValue implements Comparable<ColumnValue> {
|
||||||
|
|
||||||
@ConvertColumn(index = 1)
|
@ConvertColumn(index = 1)
|
||||||
private String column;
|
private String column;
|
||||||
@@ -528,8 +528,14 @@ public class ColumnValue {
|
|||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compareTo(ColumnValue o) {
|
||||||
|
return o == null ? 1 : this.column.compareTo(o.column);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "{\"column\":\"" + column + "\", \"express\":" + express + ", \"value\":" + value + "}";
|
return "{\"column\":\"" + column + "\", \"express\":" + express + ", \"value\":" + value + "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -701,6 +701,11 @@ public final class EntityInfo<T> {
|
|||||||
return (V) this.subobjectMap.get(name);
|
return (V) this.subobjectMap.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public <V> V getSubobjectIfAbsent(String name, Function<String, ? extends V> func) {
|
||||||
|
return (V) this.subobjectMap.computeIfAbsent(name, func);
|
||||||
|
}
|
||||||
|
|
||||||
public void setSubobject(String name, Object value) {
|
public void setSubobject(String name, Object value) {
|
||||||
this.subobjectMap.put(name, value);
|
this.subobjectMap.put(name, value);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user