mybatis plus 分页组件和pagehelper 组件共存问题

8月 10, 2022 |

他们都是给予mybatis Interceptor实现, pagehelper将分页参数放入ThreadLocal隐式传递,而mybatis plus 分页是通过参数显示传递,mybatis plus不会自动注册PaginationInterceptor拦截器, 需要手动注册,所以这两个参数是能共存的, pagehelper对应的拦截器为PageInterceptor。
他们的实现也基本相同, 通过jsqlparser库将sql 字符串转换成对象。根据业务sql 产生对应的count sql查询count, 然后依据方言, 拼接上对应的分页命令。比如mysql的limit

Posted in: database

Comments are closed.