PageHelper method uses the static
ThreadLocal parameter, and the paging parameter is bound to the thread.
This is safe as long as we guarantee that the
MyBatis query method is immediately followed by the
PageHelper method call. Because
PageHelper automatically clears the object stored in
ThreadLocal in the
finally code segment.
start in a thread does not guarantee that the thread has cleaned up the page variable when the current execution exits.
The paging process of a
PageHelper is as follows:
Interceptorinterface, check whether there is a set
page sql, and execute the query. There is no
pageparameter, return the query result directly
LOCAL_PAGE.remove()to clear the
PageHelper.clearPage() at the end of a method using