解决:net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: “=“ “=“

Error message:

Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "=" "="
    at line 3, column 22.

Was expecting one of:

Caused by: net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "=" "="
    at line 3, column 22.

Was expecting one of:

    "&"
    "&&"
    ")"
    "::"
    "<<"
    ">>"
    "AND"
    "AT"
    "COLLATE"
    "CONNECT"
    "EXCEPT"
    "FOR"
    "GROUP"
    "HAVING"
    "INTERSECT"
    "MINUS"
    "OR"
    "START"
    "UNION"
    "XOR"
    "["
    "^"
    "|"

	at net.sf.jsqlparser.parser.CCJSqlParser.generateParseException(CCJSqlParser.java:30694)
	at net.sf.jsqlparser.parser.CCJSqlParser.jj_consume_token(CCJSqlParser.java:30527)
	at net.sf.jsqlparser.parser.CCJSqlParser.FromItem(CCJSqlParser.java:7692)
	at net.sf.jsqlparser.parser.CCJSqlParser.PlainSelect(CCJSqlParser.java:5443)
	at net.sf.jsqlparser.parser.CCJSqlParser.SetOperationList(CCJSqlParser.java:5645)
	at net.sf.jsqlparser.parser.CCJSqlParser.SelectBody(CCJSqlParser.java:5324)
	at net.sf.jsqlparser.parser.CCJSqlParser.Select(CCJSqlParser.java:5319)
	at net.sf.jsqlparser.parser.CCJSqlParser.SingleStatement(CCJSqlParser.java:232)
	at net.sf.jsqlparser.parser.CCJSqlParser.Statement(CCJSqlParser.java:153)
	at net.sf.jsqlparser.parser.CCJSqlParserUtil.parseStatement(CCJSqlParserUtil.java:188)

I have read a lot on the Internet, and it is said that because of the multi-tenant function in the MyBatis_Plus framework, MP will filter data permissions, but I have tried it and found that it does not work. Remember that I have encountered this problem before, because of the package. It is caused by the version, but I forgot it, so I will write it down this time, lest I forget it again.

reason:

The mybatis-plus package conflicts with the original pagehelper com.github.jsqlparser:jsqlparser

solution:

solve:

1. Exclude the jsqlparser package in other dependencies, introduce a new jsqlparser, or exclude only one of them, and use another jsqlparser package without re-importing

Exclude jsqlparser in pageHelper

            <dependency>
                <groupId>com.github.pagehelper</groupId>
                <artifactId>pagehelper-spring-boot-starter</artifactId>
                <version>${pagehelper.boot.version}</version>
                <exclusions>
                    <!-- 解决jsqlparser 依赖版本冲突-->
                    <exclusion>
                        <artifactId>jsqlparser</artifactId>
                        <groupId>com.github.jsqlparser</groupId>
                    </exclusion>
                </exclusions>
            </dependency>

Exclude jsqlparser in Mybatis-Plus

        <!-- mybatis-plus 增强CRUD -->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.4.1</version>
            <exclusions>
                <!-- 解决jsqlparser 依赖版本冲突&ndash;&gt;-->
                <exclusion>
                    <artifactId>jsqlparser</artifactId>
                    <groupId>com.github.jsqlparser</groupId>
                </exclusion>                      				
            </exclusions>
        </dependency>

Introduce new jsqlparser

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

2. Modify the version of MyBatis-plus or pageHelper package, the version of Mybatis-Plus I use here is 3.4.1, and the version of pageHelper is 1.3.0

 

You can adjust the version, order or exclude conflicting jar packages according to the maven dependency principle

Guess you like

Origin blog.csdn.net/xiaozhang_man/article/details/127193780