Home > Back-end >  General mapper paging query more conditions
General mapper paging query more conditions

Time:04-02

Used for the first time, also not familiar with, used the bosses, can give a source and see it

CodePudding user response:

 
@ Override
Public List FindPage (String appId, int pageNum, int pageSize) {
//page
PageHelper PageHelper=new PageHelper ();

//filter
Example Example=new Example (User. The class);
Example. The Criteria the Criteria=Example. CreateCriteria ();
If (appId!=null) {
Criteria. AndEqualTo (" appId ", appId);
}
//if (StringUtils. IsNotBlank (appId)) {
////filter
//example. CreateCriteria (). OrLike (" username ", "%" + key toLowerCase () + "%"). The orEqualTo (" phone ", the key toLowerCase ());
//}
//is paging parameters, the current number of pages, each page display number
PageHelper. StartPage (pageNum, pageSize);
//query
//List The userList=userMapper. SelectByExample (example);
List The userList=userMapper. SelectByExampleAndRowBounds (example,));
return userList;
}



Paging query call selectByExampleAndRowBounds this method?
The inside of the parameters, the second how to write?

CodePudding user response:

Use pagehelper can

CodePudding user response:

refer to the second floor understand amidst a reply:
can use pagehelper


Put it on the selectByExampleAndRowBounds (example, pageHelper) here? Try the complains

CodePudding user response:

Should return PageInfo object of ah, otherwise how effective paging
  • Related