Mysql PageHelper and mysqlpagehelper
The first paging processing (I don't know what paging processing will do ?)
Understanding: in fact, the front-end page passes different parameters {1. query conditions. 2. page number (pageNum), 3 the number of items displayed per page (pageSize)}, then we (only process data in the background (if the front-end data is displayed correctly, OK ), no matter whether the front-end uses the data to dry the wool)
[
{
"Id": 64,
"Name": "fdsaf"
}
]
The format is the postman get test (this format is used anyway)
. No matter what SQL query is done, first query all the data that may be needed in the foreground in the xxxx visualization tool (if you cannot use the command window, there is no way to say "the old driver takes me with me") (in fact, it is more convenient to write a series of SQL statements and then modify them)
Note:
1
<If test = "name! = Null and name! = ''">
AND name LIKE '% $ {name} %'
</If>
(Transfer)
1. String concatenation in SQL
SELECT * FROM tableName WHERE name like concat ('%', # {text}), '% ');
2. Use $ {...} Instead #{...}
SELECT * FROM tableName WHERE name LIKE '% $ {text} % ';
(The SQL statement used to be written in this way. I have been debugging for a long time because the company's direct fuzzy query is '%' + {name} + '%', but it cannot. The second method I used directly)
2. The fields to be queried by the interface queried in the mapper. java file must be @ Parem ("xxx") or you will understand
List<Category> findAll(@Param("name") String name)throws Exception;
PageHelper usage:
PageHelper. startPage (currenPage, pageSize); ----->PageHelper can be used directly
List <Category> list = categoryMapper. findAll (name );
List is the result returned.