public interface CommonSelectMapper
ResultMap
for each statement.
This mapper contains three types of methods:
This mapper can be injected as-is into a MyBatis configuration, or it can be extended with existing mappers.
Modifier and Type | Method and Description |
---|---|
default <R> List<R> |
selectMany(SelectStatementProvider selectStatement,
Function<Map<String,Object>,R> rowMapper)
Select any number of rows and then convert the values to a custom type.
|
List<BigDecimal> |
selectManyBigDecimals(SelectStatementProvider selectStatement)
Retrieve a List of
BigDecimal from a result set. |
List<Double> |
selectManyDoubles(SelectStatementProvider selectStatement)
Retrieve a List of
Double from a result set. |
List<Integer> |
selectManyIntegers(SelectStatementProvider selectStatement)
Retrieve a List of
Integer from a result set. |
List<Long> |
selectManyLongs(SelectStatementProvider selectStatement)
Retrieve a List of
Long from a result set. |
List<Map<String,Object>> |
selectManyMappedRows(SelectStatementProvider selectStatement)
Select any number of rows and return a List of Maps containing row values (one Map for each row returned).
|
List<String> |
selectManyStrings(SelectStatementProvider selectStatement)
Retrieve a List of
String from a result set. |
default <R> R |
selectOne(SelectStatementProvider selectStatement,
Function<Map<String,Object>,R> rowMapper)
Select a single row of values and then convert the values to a custom type.
|
BigDecimal |
selectOneBigDecimal(SelectStatementProvider selectStatement)
Retrieve a single
BigDecimal from a result set. |
Double |
selectOneDouble(SelectStatementProvider selectStatement)
Retrieve a single
Double from a result set. |
Integer |
selectOneInteger(SelectStatementProvider selectStatement)
Retrieve a single
Integer from a result set. |
Long |
selectOneLong(SelectStatementProvider selectStatement)
Retrieve a single
Long from a result set. |
Map<String,Object> |
selectOneMappedRow(SelectStatementProvider selectStatement)
Select a single row as a Map of values.
|
String |
selectOneString(SelectStatementProvider selectStatement)
Retrieve a single
String from a result set. |
Optional<BigDecimal> |
selectOptionalBigDecimal(SelectStatementProvider selectStatement)
Retrieve a single
BigDecimal from a result set. |
Optional<Double> |
selectOptionalDouble(SelectStatementProvider selectStatement)
Retrieve a single
Double from a result set. |
Optional<Integer> |
selectOptionalInteger(SelectStatementProvider selectStatement)
Retrieve a single
Integer from a result set. |
Optional<Long> |
selectOptionalLong(SelectStatementProvider selectStatement)
Retrieve a single
Long from a result set. |
Optional<String> |
selectOptionalString(SelectStatementProvider selectStatement)
Retrieve a single
String from a result set. |
@SelectProvider(type=SqlProviderAdapter.class, method="select") Map<String,Object> selectOneMappedRow(SelectStatementProvider selectStatement)
selectStatement
- the select statementdefault <R> R selectOne(SelectStatementProvider selectStatement, Function<Map<String,Object>,R> rowMapper)
See selectOneMappedRow(SelectStatementProvider)
for details about
how MyBatis will construct the Map of values.
R
- the datatype of the converted objectselectStatement
- the select statementrowMapper
- a function that will convert a Map of row values to the desired data type@SelectProvider(type=SqlProviderAdapter.class, method="select") List<Map<String,Object>> selectManyMappedRows(SelectStatementProvider selectStatement)
selectStatement
- the select statementdefault <R> List<R> selectMany(SelectStatementProvider selectStatement, Function<Map<String,Object>,R> rowMapper)
R
- the datatype of the converted objectselectStatement
- the select statementrowMapper
- a function that will convert a Map of row values to the desired data type@SelectProvider(type=SqlProviderAdapter.class, method="select") BigDecimal selectOneBigDecimal(SelectStatementProvider selectStatement)
BigDecimal
from a result set. The result set must have
only one column and one or zero rows. The column must be retrievable from the result set
via the ResultSet.getBigDecimal() method.selectStatement
- the select statement@SelectProvider(type=SqlProviderAdapter.class, method="select") Optional<BigDecimal> selectOptionalBigDecimal(SelectStatementProvider selectStatement)
BigDecimal
from a result set. The result set must have
only one column and one or zero rows. The column must be retrievable from the result set
via the ResultSet.getBigDecimal() method.selectStatement
- the select statement@SelectProvider(type=SqlProviderAdapter.class, method="select") List<BigDecimal> selectManyBigDecimals(SelectStatementProvider selectStatement)
BigDecimal
from a result set. The result set must have
only one column, but can have any number of rows. The column must be retrievable from the result set
via the ResultSet.getBigDecimal() method.selectStatement
- the select statement@SelectProvider(type=SqlProviderAdapter.class, method="select") Double selectOneDouble(SelectStatementProvider selectStatement)
Double
from a result set. The result set must have
only one column and one or zero rows. The column must be retrievable from the result set
via the ResultSet.getDouble() method.selectStatement
- the select statement@SelectProvider(type=SqlProviderAdapter.class, method="select") Optional<Double> selectOptionalDouble(SelectStatementProvider selectStatement)
Double
from a result set. The result set must have
only one column and one or zero rows. The column must be retrievable from the result set
via the ResultSet.getDouble() method.selectStatement
- the select statement@SelectProvider(type=SqlProviderAdapter.class, method="select") List<Double> selectManyDoubles(SelectStatementProvider selectStatement)
Double
from a result set. The result set must have
only one column, but can have any number of rows. The column must be retrievable from the result set
via the ResultSet.getDouble() method.selectStatement
- the select statement@SelectProvider(type=SqlProviderAdapter.class, method="select") Integer selectOneInteger(SelectStatementProvider selectStatement)
Integer
from a result set. The result set must have
only one column and one or zero rows. The column must be retrievable from the result set
via the ResultSet.getInt() method.selectStatement
- the select statement@SelectProvider(type=SqlProviderAdapter.class, method="select") Optional<Integer> selectOptionalInteger(SelectStatementProvider selectStatement)
Integer
from a result set. The result set must have
only one column and one or zero rows. The column must be retrievable from the result set
via the ResultSet.getInt() method.selectStatement
- the select statement@SelectProvider(type=SqlProviderAdapter.class, method="select") List<Integer> selectManyIntegers(SelectStatementProvider selectStatement)
Integer
from a result set. The result set must have
only one column, but can have any number of rows. The column must be retrievable from the result set
via the ResultSet.getInt() method.selectStatement
- the select statement@SelectProvider(type=SqlProviderAdapter.class, method="select") Long selectOneLong(SelectStatementProvider selectStatement)
Long
from a result set. The result set must have
only one column and one or zero rows. The column must be retrievable from the result set
via the ResultSet.getLong() method.selectStatement
- the select statement@SelectProvider(type=SqlProviderAdapter.class, method="select") Optional<Long> selectOptionalLong(SelectStatementProvider selectStatement)
Long
from a result set. The result set must have
only one column and one or zero rows. The column must be retrievable from the result set
via the ResultSet.getLong() method.selectStatement
- the select statement@SelectProvider(type=SqlProviderAdapter.class, method="select") List<Long> selectManyLongs(SelectStatementProvider selectStatement)
Long
from a result set. The result set must have
only one column, but can have any number of rows. The column must be retrievable from the result set
via the ResultSet.getLong() method.selectStatement
- the select statement@SelectProvider(type=SqlProviderAdapter.class, method="select") String selectOneString(SelectStatementProvider selectStatement)
String
from a result set. The result set must have
only one column and one or zero rows. The column must be retrievable from the result set
via the ResultSet.getString() method.selectStatement
- the select statement@SelectProvider(type=SqlProviderAdapter.class, method="select") Optional<String> selectOptionalString(SelectStatementProvider selectStatement)
String
from a result set. The result set must have
only one column and one or zero rows. The column must be retrievable from the result set
via the ResultSet.getString() method.selectStatement
- the select statement@SelectProvider(type=SqlProviderAdapter.class, method="select") List<String> selectManyStrings(SelectStatementProvider selectStatement)
String
from a result set. The result set must have
only one column, but can have any number of rows. The column must be retrievable from the result set
via the ResultSet.getString() method.selectStatement
- the select statementCopyright © 2016–2021 MyBatis.org. All rights reserved.