Closed EntiWe closed 1 week ago
提供堆栈信息.
error.log
我发现他在非法SQL拦截器那个位置 因为使用了分页插件嘛然后 分页插件的查询数据条数的SQL 将我的整个SQL重新写成了一个子查询我的where条件被写在了子查询里面去了
当我试图通过这种方式绕口验证时又因为子查询的拦截导致报错
2024-07-05T19:57:25.708+08:00 ERROR 19760 --- [zhaoshou-app-admin] [io-10120-exec-8] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: org.mybatis.spring.MyBatisSystemException] with root cause
java.lang.ClassCastException: class net.sf.jsqlparser.statement.select.ParenthesedSelect cannot be cast to class net.sf.jsqlparser.schema.Table (net.sf.jsqlparser.statement.select.ParenthesedSelect and net.sf.jsqlparser.schema.Table are in unnamed module of loader 'app') at com.baomidou.mybatisplus.extension.plugins.inner.IllegalSQLInnerInterceptor.processSelect(IllegalSQLInnerInterceptor.java:125) ~[mybatis-plus-extension-3.5.7.jar:3.5.7] at com.baomidou.mybatisplus.extension.parser.JsqlParserSupport.processParser(JsqlParserSupport.java:90) ~[mybatis-plus-extension-3.5.7.jar:3.5.7] at com.baomidou.mybatisplus.extension.parser.JsqlParserSupport.parserSingle(JsqlParserSupport.java:49) ~[mybatis-plus-extension-3.5.7.jar:3.5.7] at com.baomidou.mybatisplus.extension.plugins.inner.IllegalSQLInnerInterceptor.beforePrepare(IllegalSQLInnerInterceptor.java:114) ~[mybatis-plus-extension-3.5.7.jar:3.5.7] at com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor.intercept(MybatisPlusInterceptor.java:102) ~[mybatis-plus-extension-3.5.7.jar:3.5.7] at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:59) ~[mybatis-3.5.16.jar:3.5.16] at jdk.proxy2/jdk.proxy2.$Proxy183.prepare(Unknown Source) ~[na:na]
当前使用版本 3.5.7 当前环境信息 java22 + SpringBoot 3.3 + mybatisplus 3.5.7
描述bug现象 在使用分页插件与SQL拦截器插件时编写的sql中带有Group By 语句不管有没有添加Where条件都会提示,非法SQL,必须要有where条件
提供问题复现步骤
![image](https://github.com/baomidou/mybatis-plus/assets/49016942/0b4a7f42-f3a4-4105-9cfb-dd3b292c87cb)
提供完整堆栈日志(可选)
提供问题复现工程(可选) 请尽量提供复现工程,减少大家排错的时间.