当前使用版本(必填,否则不予处理)

3.4.0

该问题是如何引起的?(确定最新版也有问题再提!!!)

最新版新增的 PaginationInnerInterceptor ,导致警告 new PaginationInnerInterceptor(DbType.MYSQL) this.logger.warn("failed to concat orderBy from IPage, exception:\n" + var8.getCause());

重现步骤(如果有就写完整)

只要有分页,就会报出这个警告,不影响代码执行,但是日志打印着不太好看

报错信息

c.b.m.e.plugins.inner.PaginationInnerInterceptor - optimize this sql to a count sql has exception 具体报错信息如下: java.lang.ClassCastException: net.sf.jsqlparser.statement.select.SubSelect cannot be cast to net.sf.jsqlparser.schema.Table at com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor.willDoQuery(PaginationInnerInterceptor.java:130) at com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor.intercept(MybatisPlusInterceptor.java:58)

Comment From: miemieYaho

你就不能看看 exception 是啥?

Comment From: chen276441970

你就不能看看 exception 是啥?

上面补全了,麻烦看一下

Comment From: miemieYaho

原始sql是啥?

Comment From: miemieYaho

你发的是构造countsql的异常不是你说的拼接orderBy的异常

Comment From: chen276441970

你发的是构造countsql的异常不是你说的拼接orderBy的异常

这个是代码里打印的警告日志代码,在PaginationInnerInterceptor类中:this.logger.warn("optimize this sql to a count sql has exception, sql:\"" + sql + "\", exception:\n" + var16.getCause());

就是countsql的异常,可以处理吗?

Comment From: miemieYaho

那是没构建count降级为了通用count肯定要打印的

Comment From: chen276441970

是没构建count降级为了通用count肯定要打印

那我直接把打印屏蔽掉,不会影响其他业务吧?谢谢

Comment From: miemieYaho

不影响

Comment From: chen276441970

不影响

好的,谢谢

Comment From: toxmc

也是这个版本报错,关键是异常是null,又不影响执行. optimize this sql to a count sql has exception, sql:"SELECT xxxt FROM xxxx WHERE ss=0

AND (xx = ?) ORDER BY id DESC", exception: null

MyBatis-Plus 新版分页配置导致:optimize this sql to a count sql has exception

Comment From: toxmc

jsqlparse 版本冲突导致的.再次遇到的,可以朝这个方向排查看看