We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
PaginationInterceptor.queryTotal 异常场景还原: try (PreparedStatement statement = connection.prepareStatement(sql)) { DefaultParameterHandler parameterHandler = new MybatisDefaultParameterHandler(mappedStatement, boundSql.getParameterObject(), boundSql); parameterHandler.setParameters(statement); int total = 0; try (ResultSet resultSet = statement.executeQuery()) { if (resultSet.next()) { total = resultSet.getInt(1); } } page.setTotal(total); /* * 溢出总页数,设置第一页 */ int pages = page.getPages(); if (overflowCurrent && (page.getCurrent() > pages)) { page = new Pagination(1, page.getSize()); page.setTotal(total); } } catch (Exception e) { logger.error("Error: Method queryTotal execution error !", e); } 如上代码, statement.executeQuery()执行sql的列有重复,则会有异常:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate column name 'status', 但是catch后没有抛出,导致 page.total默认0
The text was updated successfully, but these errors were encountered:
感谢反馈已修复 1bf620f
Sorry, something went wrong.
No branches or pull requests
PaginationInterceptor.queryTotal
异常场景还原:
try (PreparedStatement statement = connection.prepareStatement(sql)) {
DefaultParameterHandler parameterHandler = new MybatisDefaultParameterHandler(mappedStatement, boundSql.getParameterObject(), boundSql);
parameterHandler.setParameters(statement);
int total = 0;
try (ResultSet resultSet = statement.executeQuery()) {
if (resultSet.next()) {
total = resultSet.getInt(1);
}
}
page.setTotal(total);
/*
* 溢出总页数,设置第一页
*/
int pages = page.getPages();
if (overflowCurrent && (page.getCurrent() > pages)) {
page = new Pagination(1, page.getSize());
page.setTotal(total);
}
} catch (Exception e) {
logger.error("Error: Method queryTotal execution error !", e);
}
如上代码, statement.executeQuery()执行sql的列有重复,则会有异常:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Duplicate column name 'status',
但是catch后没有抛出,导致 page.total默认0
The text was updated successfully, but these errors were encountered: