当前使用版本(必填,否则不予处理)
该问题是如何引起的?(确定最新版也有问题再提!!!)
如下述代码: 从db 中查询,total为0时,报空指针,debug 发现在PaginationInterceptor中,这段代码返回空 if (!this.continueLimit(page)) { return null; } 引起后续typeHandler 设置参数报空指针
public interface IBaseService
default Page<T> getEntitysByName(Page<T> page, T entity){
QueryWrapper<T> queryWrapper = new QueryWrapper<T>();
if(entity.getName()!=null){
queryWrapper.eq("name",entity.getName());
}
queryWrapper.orderByAsc("create_date");
Page<T> pages = this.page(page,queryWrapper);
return pages;
}
}
重现步骤(如果有就写完整)
执行上述代码
报错信息
2020-12-01 15:36:31.374 ERROR 48976 --- [p-nio-80-exec-5] com.customer.controller.FileController : nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='ew.paramNameValuePairs.MPGENVAL1', mode=IN, javaType=class java.lang.Object, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #1 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #1 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.lang.NullPointerException
Comment From: miemieYaho
https://mybatis.plus/guide/interceptor.html
Comment From: shangmingzhen
https://mybatis.plus/guide/interceptor.html
谢谢,新的分页插件不会出现空指针。对比了下, 我是从拉的git 上的mybatis demo ,里面用的旧分页插件