Home >Java >javaTutorial >What is the paging principle of mybatis?

What is the paging principle of mybatis?

coldplay.xixi
coldplay.xixiOriginal
2020-06-22 11:19:207937browse

What is the paging principle of mybatis?

Recommended tutorial: "java Video Article"

What is the paging principle of mybatis?

Mybatis paging principle is:

First, an interceptor interface is defined inside MyBatis

All plug-ins must implement this Interface, let's take a look at the definition of this interface

public interface Interceptor {
  Object intercept(Invocation invocation) throws Throwable;
  Object plugin(Object target);
  void setProperties(Properties properties);
}

Then one of the key methods is intercept, so as to achieve interception

The principle of paging plug-in is to use the plug-in interface provided by MyBatis to realize self-interception Define the plug-in, intercept the SQL to be executed in the interception method of the plug-in, and then rewrite the SQL according to the set dialect (dialect) and the set paging parameters, generate SQL with paging statements, and execute the rewritten SQL. To achieve paging

So the principle is still based on the interceptor

Recommended related articles: "mybatis"

The above is the detailed content of What is the paging principle of mybatis?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn