多表条件导致count数与列表数不一致,这时beetl所提供的pageTag将无法满足分页查询
解决方法有两种:
1、分别写查询的sql和count的sql
如:
queryNewUser
===
select * from user order by id desc ;
queryNewUser$count
===
select count(1) from user
2、就是在原先的sql再包一层selet* from
如:
SELECT
@pageTag(){
*
@}
FROM(
SELECT
c.NAME as school_name,
count( a.id ) AS integralNums,
count( DISTINCT a.user_id ) AS peopleNums
FROM
mall_wx_user_read_sign a,
mall_wx_user b,
mall_school c
WHERE
a.user_id = b.id
AND b.school_id = c.id
AND a.goods_id = #goodsId#
AND a.store_id = #storeId#
@if(!isEmpty(schoolName)&& schoolName != ''){
AND c.name =#schoolName#
@}
@if(!isEmpty(startTime) && startTime != ''){
and a.create_time >= #startTime#
@}
@if(!isEmpty(endTime) && endTime != ''){
and a.create_time < #endTime#
@}
GROUP BY
b.school_id
@pageIgnoreTag(){
ORDER BY a.create_time desc
@}
)xx
这种就避免写多条sql,推荐这种。