Configuration and simple usage of mybatis paging plug-in PageHelper (recommended)

preface

When tables are involved in the process of web development, such as datatable, there will be paging requirements. Generally, we divide paging methods into two types: front-end paging and back-end paging.

Front end paging

All records (Ajax) in the data table are requested at one time, and then the count and paging logic are cached and calculated in the front end. Generally, the front-end component (such as datatable) will provide paging action.

The features are: simple and suitable for small-scale web platform; When the amount of data is large, performance problems will occur, and the time of query and network transmission will be very long.

Back end paging

Specify the page number (pagenum) and the size of each page (PageSize) in the Ajax request. The back end queries the data of the current page, and the front end is only responsible for rendering.

The characteristics are: more complex; The performance bottleneck lies in the query performance of MySQL. Of course, this can be tuned and solved. In general, web development uses this approach.

We are also talking about back-end paging.

MySQL support for paging

Simply put, MySQL supports paging through the limit clause. Look at the example below.

The usage of the limit keyword is

LIMIT [offset,] rows
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>