本文整理汇总了Java中org.apache.ibatis.mapping.StatementType.PREPARED属性的典型用法代码示例。如果您正苦于以下问题:Java StatementType.PREPARED属性的具体用法?Java StatementType.PREPARED怎么用?Java StatementType.PREPARED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.ibatis.mapping.StatementType
的用法示例。
在下文中一共展示了StatementType.PREPARED属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: genKeyGenerator
/**
* <p>
* 自定义 KEY 生成器
* </p>
*/
public static KeyGenerator genKeyGenerator(TableInfo tableInfo, MapperBuilderAssistant builderAssistant,
String baseStatementId, LanguageDriver languageDriver) {
Incrementer incrementer = GlobalConfigUtils.getIncrementer(builderAssistant.getConfiguration());
if (null == incrementer) {
throw new MybatisPlusException("Error: not configure Incrementer implementation class.");
}
String id = baseStatementId + SelectKeyGenerator.SELECT_KEY_SUFFIX;
Class<?> resultTypeClass = tableInfo.getKeySequence().idClazz();
StatementType statementType = StatementType.PREPARED;
String keyProperty = tableInfo.getKeyProperty();
String keyColumn = tableInfo.getKeyColumn();
SqlSource sqlSource = languageDriver.createSqlSource(builderAssistant.getConfiguration(),
incrementer.getSequenceQuery(tableInfo.getKeySequence().value()), null);
builderAssistant.addMappedStatement(id, sqlSource, statementType, SqlCommandType.SELECT, null, null, null,
null, null, resultTypeClass, null, false, false, false,
new NoKeyGenerator(), keyProperty, keyColumn, null, languageDriver, null);
id = builderAssistant.applyCurrentNamespace(id, false);
MappedStatement keyStatement = builderAssistant.getConfiguration().getMappedStatement(id, false);
SelectKeyGenerator keyGenerator = new SelectKeyGenerator(keyStatement, true);
builderAssistant.getConfiguration().addKeyGenerator(id, keyGenerator);
return keyGenerator;
}
示例2: genKeyGenerator
/**
* <p>
* 自定义 KEY 生成器
* </p>
*/
public static KeyGenerator genKeyGenerator(TableInfo tableInfo, MapperBuilderAssistant builderAssistant,
String baseStatementId, LanguageDriver languageDriver) {
IKeyGenerator keyGenerator = GlobalConfigUtils.getKeyGenerator(builderAssistant.getConfiguration());
if (null == keyGenerator) {
throw new IllegalArgumentException("not configure IKeyGenerator implementation class.");
}
String id = baseStatementId + SelectKeyGenerator.SELECT_KEY_SUFFIX;
Class<?> resultTypeClass = tableInfo.getKeySequence().clazz();
StatementType statementType = StatementType.PREPARED;
String keyProperty = tableInfo.getKeyProperty();
String keyColumn = tableInfo.getKeyColumn();
SqlSource sqlSource = languageDriver.createSqlSource(builderAssistant.getConfiguration(),
keyGenerator.executeSql(tableInfo.getKeySequence().value()), null);
builderAssistant.addMappedStatement(id, sqlSource, statementType, SqlCommandType.SELECT, null, null, null,
null, null, resultTypeClass, null, false, false, false,
new NoKeyGenerator(), keyProperty, keyColumn, null, languageDriver, null);
id = builderAssistant.applyCurrentNamespace(id, false);
MappedStatement keyStatement = builderAssistant.getConfiguration().getMappedStatement(id, false);
SelectKeyGenerator selectKeyGenerator = new SelectKeyGenerator(keyStatement, true);
builderAssistant.getConfiguration().addKeyGenerator(id, selectKeyGenerator);
return selectKeyGenerator;
}
示例3: bindingLog
private void bindingLog(Invocation invocation) throws SQLException {
Object[] args = invocation.getArgs();
MappedStatement ms = (MappedStatement) args[0];
Object parameterObject = args[1];
StatementType statementType = ms.getStatementType();
if (StatementType.PREPARED == statementType || StatementType.CALLABLE == statementType) {
Log statementLog = ms.getStatementLog();
if (isDebugEnable(statementLog)) {
BoundSql boundSql = ms.getBoundSql(parameterObject);
String sql = boundSql.getSql();
List<String> parameterList = getParameters(ms, parameterObject, boundSql);
debug(statementLog, "==> BindingLog: " + bindLogFormatter.format(sql, parameterList));
}
}
}