Home > Back-end >  Query paging
Query paging

Time:11-23

Query paging should do? The front-end code and back-end code should be how to write?

CodePudding user response:

This problem is too big is too general, let people don't know how to answer, they said the back-end, query way of JDBC, hibernate, jpa, mybatis that several kinds of every kind of way of query, paging, code is different, you still more system under the study of first

CodePudding user response:

You said the paging concept was actually a bit fuzzy, do you want to be paged or need to query for each query fixed number?

The former, you can once get all the qualified data, and then through the front-end control, according to

The latter is a little bit of trouble, can send the request back when click the page number at the front end, the request attached pages (pageNo) and each page article number (pageSize), and then through the SQL statements add restrictions to control the query data (similar to the first floor, select the database connection in a different way, specific writing is different, but this can be according to the situation of baidu)

CodePudding user response:

Front page, is the back-end you put all the data is returned to you the inside an array, or else you take 10 pages,
Backend paging, is the front end with parameters into the backend, such as the first page, each page 10 to give in to the SQL database is then only take this article 10 data back to the front end

CodePudding user response:

Front call interface was introduced into the page, pageSize is the number of pages and each page shows article how much
Int the begin=(page 1) * pageSize
The back-end query SQL using limit the begin, pageSize

CodePudding user response:

Implementation:
1, through the database operations statement:
 
Select * from table limit 0, 8 # just for an example of paging query

As to how the backend logic control, need you think, the best combination of Ajax requests to write, better ha
2, the use of plug-in pageHelper I haven't tried this, look at the others used

CodePudding user response:

This should meet your requirements, you can refer to https://blog.csdn.net/Easet/article/details/99588673

CodePudding user response:

You can go to search, a lot of, can be custom tools can also use mybatis paging plug-in implementation, paging logic to find online, according to the demand paging, not looking for a video

CodePudding user response:

Introduction can try to write the words after the front end, SQL statements mainly use limit keywords, front-end needs pageSize and pageNum two values, the back-end according to these two values encapsulate data back to the front show, after the implementation can use general mapper maybatis plug-in, principle also understand,

CodePudding user response:

refer to the eighth floor Yokeuu response:
introduction can try to write the words after the front end, SQL statements mainly use limit keywords, front-end needs pageSize and pageNum two values, the back-end according to these two values encapsulate data back to the front show, after the implementation can use general mapper maybatis plug-in, principle also understand,

Actually wanted to ask is, input the key words in the search box after click on search results after how paging, after can be found at the time of each page can pass the back-end, the keyword also together with limit the where keyword=# {keyword} ways

CodePudding user response:

Paging several core data:
1, the page size (size)
2, the current page (currentPage)
3, the total number of pages (totalPage)
General front end to your page size and the current page (background can default, such as it is not the default page one, article 20 data), the background query the data returned to bring the total to the total number of article, and calculated the total number of pages

CodePudding user response:

references 9 f word son early reply:
Quote: refer to the eighth floor Yokeuu response:
introduction can try to write the words after the front end, SQL statements mainly use limit keywords, front-end needs pageSize and pageNum two values, the back-end according to these two values encapsulate data back to the front show, after the implementation can use general mapper maybatis plug-in, principle also understand,

Actually wanted to ask is, input the key words in the search box after click on search results after how paging, after can be found at the time of each page can pass the back-end, the keyword also together with limit the where keyword=# {keyword} way
you are right, actually paging is on the basis of the conditions of the original query and limit

CodePudding user response:

According to your question, I think the front should this first, and then, in this way, the back end should be so, then this, then that would be great

CodePudding user response:

Mybatisplus encapsulates the paging method to see inside the
Paging in many places can be SQL code, and so on
  • Related