EntityInfo优化

This commit is contained in:
redkale
2023-12-04 15:30:29 +08:00
parent c62b55fea4
commit 158ff3b961
3 changed files with 13 additions and 2 deletions

View File

@@ -216,7 +216,7 @@ public abstract class AbstractDataSource extends AbstractService implements Data
* @return 对象
*/
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);
}
/**

View File

@@ -21,7 +21,7 @@ import org.redkale.util.*;
*
* @author zhangjx
*/
public class ColumnValue {
public class ColumnValue implements Comparable<ColumnValue> {
@ConvertColumn(index = 1)
private String column;
@@ -528,8 +528,14 @@ public class ColumnValue {
this.value = value;
}
@Override
public int compareTo(ColumnValue o) {
return o == null ? 1 : this.column.compareTo(o.column);
}
@Override
public String toString() {
return "{\"column\":\"" + column + "\", \"express\":" + express + ", \"value\":" + value + "}";
}
}

View File

@@ -701,6 +701,11 @@ public final class EntityInfo<T> {
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) {
this.subobjectMap.put(name, value);
}