net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: ":" ":"

[2022-07-21 14:13:23.051][WARN ][30][com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor.autoCountSql:329] optimize this sql to a count sql has exception, sql:"select * from (
            select d.* from
            (SELECT id
             FROM (SELECT t1.id,
                          CASE WHEN FIND_IN_SET(parent_id, @pids) > 0 THEN @pids := CONCAT( @pids, ',', id )ELSE 0 END  AS ischild
                   FROM (SELECT id, parent_id FROM sys_user t ORDER BY parent_id, id) t1,
                        (SELECT @pids := ?) t2
                  ) t3
             WHERE ischild !=0
             union
             SELECT ?) s LEFT JOIN device d on s.id = d.user_id where d.id IS NOT NULL and d.del_flag = 0
        ) a  ORDER BY create_time DESC", exception:
net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: ":" ":"
    at line 5, column 82.

Was expecting one of:

    "&"
    "&&"
    "."
    "::"
    "<<"
    ">>"
    "AND"
    "COLLATE"
    "ELSE"
    "END"
    "WHEN"
    "["
    "^"
    "|"

  这个异常 net.sf.jsqlparser.parser.ParseException 百度了很多,都无法解决,与mybatisplus 什么多租户没关系

  问题:缺少sql解析工具的jar包

  解决:引入jsqlparser依赖

<dependency>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
<version>4.2</version>
</dependency>

posted @ 2022-07-21 14:19  wobzd  阅读(5871)  评论(1编辑  收藏  举报