Mybatis uses the PageHelper paging plug-in to count the number without query conditions.

< H2 > A problem found when using Mybatis PageHelper does bring the data with it when querying the data, but it is not added to the condition when counting the quantity! < / H2 >

here is the code for paging query

DataPage<T> dataPage = new DataPage<T>();
Page<T> page = PageHelper.offsetPage(param.getStart(), param.getLength());
findList(param);
The values of

parameter param are:

  • billTime: 2018-07-04T00:00:00.000+0800
  • billMonth: 201805
The

SQL statement is roughly as follows:

select * 
from table
where 
a.billTime >= -sharp{billTime}
AND b.chargeperiod like CONCAT("%",-sharp{billMonth},"%")

but the strange thing is that the second parameter of
is not taken when counting the quantity, but it is always brought when querying the data. Has anyone ever encountered a similar problem? (v ^ _ ^) v
the SQL of the statistical quantity is roughly as follows:

select count(*)
from table
a.billTime >= ?

the SQL of querying data is normal.

select * 
from table
where 
a.billTime >= ?
AND b.chargeperiod like CONCAT("%",?,"%")

does it mean that if the attribute name is inconsistent with the column name, it will not be added to the statistical quantity condition?

Mar.23,2021
Menu