-
Notifications
You must be signed in to change notification settings - Fork 579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mybatis添加分页拦截器后出现的取值问题 #18
Labels
Comments
这个错只有 foreach 会出现,你分页用的什么版本? |
if(page.getAutoCount() == 0) {
queryArgs[0] = this.clone(ms, ms.getBoundSql(parameterObject), page);
}
Future listFuture1 = this.call(new Callable() {
public List call() throws Exception {
return (List)invocation.proceed();
}
}, this.asyncCount);
page.setResult((List)listFuture1.get());
if(page.getAutoCount() == 0) {
Callable countTask = new Callable() {
public Object call() throws Exception {
Configuration configuration = ms.getConfiguration();
String countSql = PageLimitInterceptor.this.dialect.getCountSql(boundSql.getSql());
if(PageLimitInterceptor.logger.isDebugEnabled()) {
PageLimitInterceptor.logger.debug("生成count语句: " + countSql);
}
PreparedStatement countStmt = executor.getTransaction().getConnection().prepareStatement(countSql);
BoundSql countBS = PageLimitInterceptor.this.dialect.getBoundSql(configuration, countSql, boundSql);
PageLimitInterceptor.this.setParameters(countStmt, configuration, countBS, parameterObject);
ResultSet rs = countStmt.executeQuery();
long count = 0L;
if(rs.next()) {
count = rs.getLong(1);
}
rs.close();
countStmt.close();
return Long.valueOf(count);
}
};
Future countFuture = this.call(countTask, this.asyncCount);
page.setTotalCount(((Long)countFuture.get()).longValue());
}
return listFuture1.get(); 问题就在这里,你所说的分页版本我暂时不清楚,mybatis 是3.4.1 的,拦截器是自己写的,没有用第三方的 |
分页插件的版本? |
不用提供版本了,这个插件不是我写的,有这个问题很正常。。 |
是的 |
请问我这个啥原因么,我想知道 |
没有处理foreach生成的动态参数。 |
是mybatis的问题 还是我的拦截器的问题?这个是我之前网上找的!另外处理foreach生成的动态参数的代码能告诉我位置么 |
拦截器的问题 |
请教你另外一个问题,前天下载了一个阿里的开发人员注意手册,里面说到update同一个表的的同一条记录时候更新的字段的数目多少影响效率,和我自己理解的就不一样(应该是和数目没关系),update实际做的就是delete 和insert |
这个问题只有大量测试才能看出来效果,不清楚数据库底层如何实现的update。 |
哦哦,谢谢了哈 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
问题代码如下:
#{item}
由于项目中用到了分页拦截器,一旦有分页的sql中,用#{}获取值都会报错( org.apache.ibatis.binding.BindingException: Parameter '__frch_item_0' not found.),换成${}这种方式就好了,请问什么原因?
The text was updated successfully, but these errors were encountered: