Home > Back-end >  After PageHelper query data paging, to secondary data processing, how to update the paging informati
After PageHelper query data paging, to secondary data processing, how to update the paging informati

Time:10-04

Help you a great god
With paging PageHelper doing at present, due to a condition in the database can not break up, I do the processing in Java, delete the list in the part of the data, but the paging information is not updated automatically, how the paging information needs to be updated, please?
The code is as follows:
 
Public List selectRecordMsg (Map filterMap) {
PageHelper. StartPage (Integer. The valueOf (filterMap. Get (HrConstants. PAGE_NUM). The toString ()), an Integer. The valueOf (filterMap
.get (HrConstants. PAGE_SIZE). The toString ()), "1". The equals (filterMap. Get (HrConstants. PAGE_NUM). The toString ()));

List List=recordMapper. SelectAllMsg (filterMap);
//here has a deal with the data, but not delete article number, so no impact for paging,
For (RecordDto RecordDto: list) {
ChangeDemand (recordDto);
BuildPersonName (recordDto);
}
//the following data is based on the condition to delete a few lines
If (a condition when processing data) {
String personName=filterMap. Get (" personName "). The toString ();
Iterator It=list. The iterator ();
While (it. HasNext ()) {
RecordDto dic=it. Next ();
If () while some condition {
It. The remove ();//here once deleted article number, paging is all messed up, don't know what to do?
}
}
}
Return the list;

Pray god help!

CodePudding user response:

Write wrong

CodePudding user response:

The
reference 1/f, James 灬 Gosling response:
write wrong
that should be how to write? For help

CodePudding user response:

Add QQ787930339

CodePudding user response:

Remove after get the list, should be to assignment,

I post this code is a problem, or your code is not complete, or your business logic is not correct,

CodePudding user response:

The only structural pageInfo manually

CodePudding user response:

Still use PageHelper? Try [making sqlhelper] (https://github.com/fangjinuo/sqlhelper),
1) support almost all of the relational database, including all the domestic database,
2) support for mybatis, mybatisplus, Spring - JDBC, Apache Commons DBUtils, jfinal, mango, ebean database operations such as framework,
3) can be seamlessly switch from PageHelper in the past, do not need to modify the code
4) automatic recognition database, 0 configuration, support for multiple database at the same time operating
5) support automatic escape parameters Like clause
6) supports a variety of custom sorting way
7) support general batch operation
8) support the dump DDL
9) support the subquery paging
10) make full use of the PreparedStatement, more efficient than pagehelper
11) support and Spring, SpringBoot rapid integration
12) more features waiting for you

CodePudding user response:

Your problem solved? To query the data, the condition judgment, paging again? I met this problem, now, o answer

CodePudding user response:

references 9 f watch_264 response:
your problem solved? To query the data, the condition judgment, paging again? I met this problem, now, please answer



Why don't condition judgment on the SQL inside?
If must be put into memory, all the door according to found out, and then their pages in memory, data may be more critical memory oh

CodePudding user response:

references to the tenth floor, James 灬 Gosling response:
Quote: references 9 f watch_264 response:

Your problem solved? To query the data, the condition judgment, paging again? I met this problem, now, please answer



Why don't condition judgment on the SQL inside?
If must be put into memory, all the door according to found out, and then their pages in memory, data may be more critical memory oh


Yes, yesterday I also want to for a long time, decided to do judgment in SQL
First, in memory to paging, write their own too time-consuming, need to find new tools, too lazy to find
Second, because I this is paging query, query only 10, almost time complexity is 10 * corresponding conditional processing complexity, and if in Java, is all data * corresponding conditional processing complexity, creating objects too much, easy to gc, and after be paged again, performance is also like that
So in conclusion, in SQL

CodePudding user response:

11 references watch_264 response:
Quote: reference to the tenth floor, James 灬 Gosling response:

Quote: references 9 floor watch_264 response:

Your problem solved? To query the data, the condition judgment, paging again? I met this problem, now, please answer



Why don't condition judgment on the SQL inside?
If must be put into memory, all the door according to found out, and then their pages in memory, data may be more critical memory oh


Yes, yesterday I also want to for a long time, decided to do judgment in SQL
First, in memory to paging, write their own too time-consuming, need to find new tools, too lazy to find
Second, because I this is paging query, query only 10, almost time complexity is 10 * corresponding conditional processing complexity, and if in Java, is all data * corresponding conditional processing complexity, creating objects too much, easy to gc, and after be paged again, performance is also like that
So in conclusion, in the SQL


In principle is to minimize the interaction with the database, and to minimize the amount of data from the database queries
  • Related