Closed li362692680 closed 1 year ago
问题和当前mapper有关吗?
pagehelper 开启 supportMethodsArguments 拦截的是mapper方法的入参,userAutoMapper.selectByExample(example); 这种方式没法把分页参数传进去,要开启分页只能调用startPage方法或者增加page对象入参,这样的话supportMethodsArguments参数就失去意义了,咨询下有没有好的办法解决?
UserAutoMapper userAutoMapper = sqlSession.getMapper(UserAutoMapper.class);
Example
增加一个通用方法即可:
/**
* 根据 Example 条件分页查询
*
* @param example 条件
* @return 实体列表
*/
@Lang(Caching.class)
@SelectProvider(type = ExampleProvider.class, method = "selectByExample")
List<T> selectByExample(E example, RowBounds rowBounds);
/**
* 根据 Example 条件分页查询
*
* @param example 条件
* @return 实体列表
*/
@Lang(Caching.class)
@SelectProvider(type = ExampleProvider.class, method = "selectByExample")
List<T> selectByExample(E example, PageRowBounds rowBounds);
其中第二个方法使用了分页插件的 PageRowBounds,上面这两个方法不能同时存在,选择一个使用。
pagehelper 开启 supportMethodsArguments 对动态查询不起作用,这个怎么解决??