新增 DefaultBeanResultMap

This commit is contained in:
2024-10-03 16:27:19 +08:00
parent fda69cea6b
commit 7f31d477d6
4 changed files with 165 additions and 7 deletions

View File

@@ -37,7 +37,6 @@ public interface ResultMap<T> {
return result;
};
public static final ResultMap<DbRecord> recordResultMap = (rs, rowNumber) -> {
DbRecord result = new DbRecord();
ResultSetMetaData metaData = rs.getMetaData();
@@ -48,4 +47,13 @@ public interface ResultMap<T> {
}
return result;
};
public static <T> ResultMap<T> beanResultMap(Class<T> beanType) throws SQLException {
return DefaultBeanResultMap.of(beanType);
}
public static <T> ResultMap<T> beanResultMap(Class<T> beanType, Map<String, String> propertyColMap)
throws SQLException {
return DefaultBeanResultMap.of(beanType, propertyColMap);
}
}