当前使用版本(必填,否则不予处理)
3.2.0
该问题是如何引起的?(确定最新版也有问题再提!!!)
使用 @SqlParser(filter = true) 注释 还是会走解析链
重现步骤(如果有就写完整)
报错信息
The error may involve com.sportswin.soa.user.dao.UserNameLibraryExtMapper.getNotUseName
The error occurred while executing a query
Cause: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Failed to process, please exclude the tableName or statementId.
Error SQL: set @update_id:=-1;
set @update_name:=-1;
select @update_id:=id,@update_name:=lib_value from u_user_name_library where use = ? limit 0,1;
update u_user_name_library set use = 1 where id = @update_id;
select @update_name;
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:149)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:76)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
... 36 more
Caused by: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Failed to process, please exclude the tableName or statementId.
Error SQL: set @update_id:=-1;
set @update_name:=-1;
select @update_id:=id,@update_name:=lib_value from u_user_name_library where use = ? limit 0,1;
update u_user_name_library set use = 1 where id = @update_id;
select @update_name;
at com.baomidou.mybatisplus.core.toolkit.ExceptionUtils.mpe(ExceptionUtils.java:39)
at com.baomidou.mybatisplus.core.parser.AbstractJsqlParser.parser(AbstractJsqlParser.java:74)
at com.baomidou.mybatisplus.extension.handlers.AbstractSqlParserHandler.sqlParser(AbstractSqlParserHandler.java:76)
at com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor.intercept(PaginationInterceptor.java:155)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
at com.sun.proxy.$Proxy267.prepare(Unknown Source)
at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:86)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)
at com.sun.proxy.$Proxy266.query(Unknown Source)
at com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:108)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
at com.sun.proxy.$Proxy266.query(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49)
at tk.mybatis.orderbyhelper.OrderByHelper.intercept(OrderByHelper.java:115)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
at com.sun.proxy.$Proxy266.query(Unknown Source)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
... 43 more
Caused by: net.sf.jsqlparser.JSQLParserException
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatements(CCJSqlParserUtil.java:124)
at com.baomidou.mybatisplus.core.parser.AbstractJsqlParser.parser(AbstractJsqlParser.java:60)
... 69 more
Caused by: net.sf.jsqlparser.parser.ParseException: Encountered " "@" "@ "" at line 1, column 5.
Was expecting one of:
"DO" ...
"ANY" ...
"KEY" ...
"SET" ...
"PERCENT" ...
"LEFT" ...
"OPEN" ...
"XML" ...
"RIGHT" ...
"VALUE" ...
"VALUES" ...
"REPLACE" ...
"TRUNCATE" ...
"CAST" ...
"OVER" ...
"PARTITION" ...
"EXTRACT" ...
"MATERIALIZED" ...
"PRIOR" ...
"SIBLINGS" ...
"COLUMN" ...
"NULLS" ...
"FIRST" ...
"LAST" ...
"ROWS" ...
"RANGE" ...
"FOLLOWING" ...
"ROW" ...
"SEPARATOR" ...
"CASCADE" ...
"NO" ...
"ACTION" ...
at net.sf.jsqlparser.parser.CCJSqlParser.generateParseException(CCJSqlParser.java:13996)
at net.sf.jsqlparser.parser.CCJSqlParser.jj_consume_token(CCJSqlParser.java:13852)
at net.sf.jsqlparser.parser.CCJSqlParser.RelObjectNameExt(CCJSqlParser.java:1596)
at net.sf.jsqlparser.parser.CCJSqlParser.Set(CCJSqlParser.java:268)
at net.sf.jsqlparser.parser.CCJSqlParser.SingleStatement(CCJSqlParser.java:162)
at net.sf.jsqlparser.parser.CCJSqlParser.Statements(CCJSqlParser.java:197)
at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatements(CCJSqlParserUtil.java:122)
... 70 more
Comment From: miemieYaho
false
Comment From: gbtyangxinhua
false
filter = false ?
Comment From: gbtyangxinhua
断点排查下来 addMapper 使用的是 MapperRegistry 而非 MybatisMapperRegistry,导致没有加载到 SqlParser ,不知道是不是那个地方配置到有问题,
现在暂时使用
这种方式排除查询
Comment From: Beer1
3以上的版本问题太多了