mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-08 01:28:24 +08:00
add comments
This commit is contained in:
parent
42b79bf1f4
commit
b0c79dac0b
@ -69,7 +69,10 @@ public class FlexConfiguration extends Configuration {
|
||||
@Override
|
||||
public ParameterHandler newParameterHandler(MappedStatement mappedStatement, Object parameterObject, BoundSql boundSql) {
|
||||
String mappedStatementId = mappedStatement.getId();
|
||||
// 以 "!selectKey" 结尾的 mappedStatementId,是用于主键生成的,无需为其设置参数
|
||||
/**
|
||||
* 以 "!selectKey" 结尾的 mappedStatementId,是用于 Sequence 生成主键的,无需为其设置参数
|
||||
* {@link SelectKeyGenerator#SELECT_KEY_SUFFIX}
|
||||
*/
|
||||
if (!mappedStatementId.endsWith(SelectKeyGenerator.SELECT_KEY_SUFFIX)
|
||||
&& parameterObject instanceof Map
|
||||
&& ((Map<?, ?>) parameterObject).containsKey(FlexConsts.SQL_ARGS)) {
|
||||
|
||||
@ -51,17 +51,16 @@ public class SqlArgsParameterHandler extends DefaultParameterHandler {
|
||||
if (sqlArgs != null && sqlArgs.length > 0) {
|
||||
int index = 1;
|
||||
for (Object value : sqlArgs) {
|
||||
if (value instanceof TypeHandlerObject){
|
||||
((TypeHandlerObject) value).setParameter(ps,index++);
|
||||
//通过配置的 TypeHandler 去设置内容
|
||||
if (value instanceof TypeHandlerObject) {
|
||||
((TypeHandlerObject) value).setParameter(ps, index++);
|
||||
}
|
||||
//在 Oracle、SqlServer 中 TIMESTAMP、DATE 类型的数据是支持 java.util.Date 给值的
|
||||
else if (value instanceof java.util.Date) {
|
||||
setDateParameter(ps, (Date) value, index++);
|
||||
} else if (value instanceof byte[]) {
|
||||
ps.setBytes(index++, (byte[]) value);
|
||||
}
|
||||
|
||||
else {
|
||||
} else {
|
||||
/** 在 MySql,Oracle 等驱动中,通过 PreparedStatement.setObject 后,驱动会自动根据 value 内容进行转换
|
||||
* 源码可参考: {{@link com.mysql.jdbc.PreparedStatement#setObject(int, Object)}
|
||||
**/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user