我在利用上述语句测试的时候,是成功的,尽管有 4 行数据,但是 total 为 3, 后续发现有个属性为 null 则他不该显示,所以在 sql 最后加了一个 where attr is not null,但后续发现, total 的值为结果的行数,并非实际对象数了。
如果能解答或提供相关帮助,万分感谢
详细堆栈日志
2024-11-13T23:57:55.994+08:00 DEBUG 11212 --- [amusement-park-server] [ main] e.c.m.m.S.pagination_mpCount : ==> Preparing: SELECT COUNT(*) AS total FROM system_user AS u LEFT JOIN system_user_role AS ur ON u.id = ur.user_id LEFT JOIN system_role AS r ON ur.role_id = r.id WHERE ur.role_id IS NOT NULL
2024-11-13T23:57:56.015+08:00 DEBUG 11212 --- [amusement-park-server] [ main] e.c.m.m.S.pagination_mpCount : ==> Parameters:
2024-11-13T23:57:56.031+08:00 DEBUG 11212 --- [amusement-park-server] [ main] e.c.m.m.S.pagination_mpCount : <== Total: 1
2024-11-13T23:57:56.035+08:00 DEBUG 11212 --- [amusement-park-server] [ main] e.c.m.m.SystemUserMapper.pagination : ==> Preparing: select u.id, u.username, u.password, u.nickname, u.phone_number, u.avatar, u.del_flag, u.create_time, u.update_time, ur.id as ur_id, ur.role_id as ur_role_id, ur.user_id as ur_user_id from system_user as u left join system_user_role as ur on u.id = ur.user_id left join system_role as r on ur.role_id = r.id where ur.role_id is not null LIMIT ?
2024-11-13T23:57:56.035+08:00 DEBUG 11212 --- [amusement-park-server] [ main] e.c.m.m.SystemUserMapper.pagination : ==> Parameters: 10(Long)
2024-11-13T23:57:56.042+08:00 DEBUG 11212 --- [amusement-park-server] [ main] e.c.m.m.SystemUserMapper.pagination : <== Total: 2
SystemUserManageInfo(super=SystemUser(id=1, username=zs, password=null, nickname=null, phoneNumber=18650758741, avatar=null, delFlag=false), roles=[SystemUserRole(id=1, userId=1, roleId=1), SystemUserRole(id=2, userId=1, roleId=2)])
2
2024-11-13T23:57:56.069+08:00 INFO 11212 --- [amusement-park-server] [ionShutdownHook] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} closing ...
2024-11-13T23:57:56.073+08:00 INFO 11212 --- [amusement-park-server] [ionShutdownHook] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} closed
确认
当前程序版本
3.5.9
问题描述
我在利用上述语句测试的时候,是成功的,尽管有 4 行数据,但是 total 为 3, 后续发现有个属性为 null 则他不该显示,所以在 sql 最后加了一个 where attr is not null,但后续发现, total 的值为结果的行数,并非实际对象数了。 如果能解答或提供相关帮助,万分感谢
详细堆栈日志