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
背景: 使用PageHelper.startPage(1, 10);方式分页
复现场景:
说明: 检查过在mybatis mapper文件中字段等映射没有错误, 也没有明确需要关联查询
排查步骤:
Integer pageNum = param.getPageNum(); Integer pageSize = param.getPageSize(); boolean pagination = Objects.nonNull(pageNum) && Objects.nonNull(pageSize); if (pagination) { PageHelper.startPage(pageNum, pageSize); } List<AppWithUserEntity> entities = appWithUserMapper.selective(entity); if (entities.isEmpty()) { return null; } PageInfo<AppWithUserEntity> pageInfo = new PageInfo<>(entities); if (!pagination) { pageInfo.setList(entities); pageInfo.setTotal(entities.size()); } return pageInfo;
PageHelper在项目中的配置:
<plugins> <!-- PageHelper --> <plugin interceptor="com.github.pagehelper.PageInterceptor"> <property name="dialect" value="com.github.pagehelper.dialect.helper.MySqlDialect"/> <property name="offsetAsPageNum" value="false"/> <property name="rowBoundsWithCount" value="true"/> <property name="pageSizeZero" value="true"/> <property name="reasonable" value="false"/> <property name="supportMethodsArguments" value="false"/> </plugin> </plugins>
03-18 17:34:39 http-nio-8001-exec-1[DEBUG][xx.xx.xx#debug:137]MYBATIS - ==> Preparing: SELECT id,user_id, app_key,app_id, `desc`, role_id, creator,operator,insert_time,update_time,yn FROM unc_app_with_user WHERE 1=1 and yn=? and user_id=? 03-18 17:34:39 http-nio-8001-exec-1[DEBUG][xx.xx.xx#debug:137]MYBATIS - ==> Parameters: 1(Integer), xx(String) 03-18 17:34:39 http-nio-8001-exec-1[DEBUG][xx.xx.xx#debug:137]MYBATIS - <== Total: 1 debug:137]MYBATIS - ==> Preparing: SELECT id,app_id, app_name, app_cn_name,app_desc,app_url,`source`,app_key,app_token,creator,operator,insert_time,update_time,yn FROM unc_app_basic_info WHERE 1=1 and app_id=? and yn=? 03-18 17:34:39 http-nio-8001-exec-1[DEBUG][xx.xx.xx#debug:137]MYBATIS - ==> Parameters: 1(String), 1(Integer) 03-18 17:34:39 http-nio-8001-exec-1[DEBUG][xx.xx.xx#debug:137]MYBATIS - <== Total: 1
select * from xxx where xxx = xxx
不用手动清理local
The text was updated successfully, but these errors were encountered:
local使用过一次就会清理,不需要手动。。
还可以用 try(Page<Object> ignored = PageHelper.startPage(1, 10)) { 这种方式保证被清理
try(Page<Object> ignored = PageHelper.startPage(1, 10)) {
Sorry, something went wrong.
并发情况下5.1.3 遇到过这个问题: 手动HandlerInterceptor清理的,可以看看
No branches or pull requests
异常模板
使用环境
背景:
使用PageHelper.startPage(1, 10);方式分页
复现场景:
说明:
检查过在mybatis mapper文件中字段等映射没有错误, 也没有明确需要关联查询
排查步骤:
PageHelper在项目中的配置:
原 SQL
期望的结果:
不用手动清理local
The text was updated successfully, but these errors were encountered: