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
?
Describe the bug PaginationHelper#fetchPage设计问题,导致不能使用 ?
PaginationHelper#fetchPage
方法PaginationHelper#fetchPage的执行过程是先查询 count (假定为 sql-1), 再查询 指定页面的数据 (假定为sql-2)。 但方法中强制要求 sql-1, sql-2 的参数必须完全一样,就导致在执行sql-2时,无法将 offset, pagesize 以 占位符 ? 形式传入。
Expected behavior 在相关的分页sql中可以使用 占位符 ?
Actually behavior 实际上不能使用。一旦使用,在 执行select count时就会出错。
How to Reproduce Steps to reproduce the behavior:
HistoryConfigInfoMapper # pageFindConfigHistoryFetchRows
例如:
public class HistoryConfigInfoMapperByMySql extends AbstractMapperByMysql implements HistoryConfigInfoMapper { // 其它方法这里忽略 @Override public MapperResult pageFindConfigHistoryFetchRows(MapperContext context) { String sql = "SELECT nid,data_id,group_id,tenant_id,app_name,src_ip,src_user,op_type,gmt_create,gmt_modified FROM his_config_info " + "WHERE data_id = ? AND group_id = ? AND tenant_id = ? ORDER BY nid DESC LIMIT ?, ?"; // + context.getStartRow() + "," +context.getPageSize( ); return new MapperResult(sql, CollectionUtils.list(context.getWhereParameter(FieldConstant.DATA_ID), context.getWhereParameter(FieldConstant.GROUP_ID), context.getWhereParameter(FieldConstant.TENANT_ID), context.getStartRow(), context.getPageSize())); } }
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
改为调用 PaginationHelper#fetchPageLimit(String sqlCountRows, Object[] args1, String sqlFetchRows, Object[] args2, int pageNo, int pageSize, RowMapper rowmapper) 可解决这个问题
PaginationHelper#fetchPageLimit(String sqlCountRows, Object[] args1, String sqlFetchRows, Object[] args2, int pageNo, int pageSize, RowMapper rowmapper)
从代码来看,有三个地方都是需要调整为PaginationHelper#fetchPageLimit(String sqlCountRows, Object[] args1, String sqlFetchRows, Object[] args2, int pageNo, int pageSize, RowMapper rowmapper)的:
ConfigInfoBetaMapper#findAllConfigInfoBetaForDumpAllFetchRows
ConfigInfoTagMapper#findAllConfigInfoTagForDumpAllFetchRows
HistoryConfigInfoMapper#pageFindConfigHistoryFetchRows
No branches or pull requests
Describe the bug
PaginationHelper#fetchPage
设计问题,导致不能使用?
方法
PaginationHelper#fetchPage
的执行过程是先查询 count (假定为 sql-1), 再查询 指定页面的数据 (假定为sql-2)。但方法中强制要求 sql-1, sql-2 的参数必须完全一样,就导致在执行sql-2时,无法将 offset, pagesize 以 占位符
?
形式传入。Expected behavior
在相关的分页sql中可以使用 占位符
?
Actually behavior
实际上不能使用。一旦使用,在 执行select count时就会出错。
How to Reproduce
Steps to reproduce the behavior:
HistoryConfigInfoMapper # pageFindConfigHistoryFetchRows
方法中,context.getStartRow(), context.getPageSize() 参数,调整为以?
方式生成SQL,去执行就会报错。例如:
The text was updated successfully, but these errors were encountered: