Before there is a requirement, in a page need to have more than one SQL paging query and then put in a list, show, but there will be a bug, that is, each time the page will show the first one to find all the data;
First page
Second page
Because the production environment is truncated, the first data is processed, all of which are different and not affected.
Look at the service method:
Public Map getinvoicelist (string epid, string parameter, int page, int pageSize) {Map result = new HashMap (); The query invoice invoiced date is less than or equal to the first 2 days of date EndTime = Dateutil.adddays (-2); Paging processing Map parammap = new HashMap (); Parammap.put ("Epid", epid); Parammap.put ("status", 10); Parammap.put ("EndTime", endTime); Pagehelper.startpage (page, pageSize); list<map> Oldmap = invoicemapper.reviewinvoicelist (PARAMMAP);//Can be reviewed invoice list<map> List = new ArrayList< ;> ();//First inspection invoice list<map> totallist = new arraylist<> ();//Verifiable invoice sum if (null! = Oldmap && !oldmap.isempty ()) {Totallist.addall (OLDMAP); Pagehelper.startpage (page, pagesize-oldmap.size ()); }else{pagehelper.startpage (page, pageSize); } list = Invoicemapper.invoicelist (Parammap); if (null! = List &&!list.isempty ()) {Totallist.addall (list); Amountformatutil.formatamount (Totallist, "Inv_amount"); }//Create return value object pageinfo<list<map>> PageInfo = new PageInfo (totallist); pageinfo<list<map>> pageInfo1 = new PageInfo (OLDMAP); pageinfo<list<map>> PageInfo2 = new PageInfo (List); Result.put ("InvoiceData", Pageinfo.getlist ()); Result.put ("Number", Pageinfo1.gettotal () +pageinfo2.gettotal ()); return result; }
Find the first SQL every time you page a query will find all:
Finally, in another blog, I found:
Finally, modify in the settings:
@Bean public Pagehelper pagehelper () { log.info ("Registered MyBatis page plug-in Pagehelper"); Pagehelper pagehelper = new Pagehelper (); Properties P = new properties (); P.setproperty ("Offsetaspagenum", "true"); P.setproperty ("Rowboundswithcount", "true"); P.setproperty ("reasonable", "false");//Before this is true pagehelper.setproperties (p); return pagehelper; }
So my query data, the first SQL total only three data, when the number of pages more than the current total number of pages will be queried the first page, that is, parameter paging rationalization, if the following brothers have encountered similar problems, hope to be able to help.
Pagehelper Multiple SQL Paging