使用 MybatisPlus 分页时如何临时不进行分页?
场景
像下面这个分页接口
List<BaseHouseOfficerVo> pageByParam(@Param("page") Page<BaseHouseOfficerVo> page, @Param("en") BaseHouseOfficerVo baseHouseOfficerVo);
试了一下不传 Page 调用
baseMapper.pageByParam(null, entity);
结果炸了。。。
错误信息
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.lang.NullPointerException
### Cause: java.lang.NullPointerException
你定义mapper方法的时候直接
List<BaseHouseOfficerVo> pageByParam@Param("en") BaseHouseOfficerVo baseHouseOfficerVo);
不就好了不要传null 声明方法的时候就不入page这个参数。
或者你假如有些地方要分有些地方不分,你mapper 用个多态