Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

连接查询报错 #138

Closed
bydongxing opened this issue May 13, 2024 · 1 comment
Closed

连接查询报错 #138

bydongxing opened this issue May 13, 2024 · 1 comment

Comments

@bydongxing
Copy link

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

		<dependency>
			<groupId>com.baomidou</groupId>
			<artifactId>mybatis-plus-boot-starter</artifactId>
			<version>3.5.6</version>
		</dependency>
		<dependency>
			<groupId>com.github.yulichang</groupId>
			<artifactId>mybatis-plus-join-boot-starter</artifactId>
			<version>1.4.12</version>
		</dependency>

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

this.baseMapper.selectJoinList(UserDTO.class, new MPJLambdaWrapper<User>()
                        // 查询 user 的所有字段
                        .selectAll(User.class)
                        .select(Address::getCity, Address::getAddress)
                        // .leftJoin(Address.class, Address::getUserId, User::getId),
                        // DataScope.builder().build());
                        .leftJoin(Address.class, Address::getUserId, User::getId)
                        .eq(User::getName, "xxxxx"))

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

报错信息

### Error querying database.  Cause: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Failed to process, Error SQL: SELECT    
t.id,t.name,t.age,t.email,t.dept_id,t.create_by,t.update_by,t.create_time,t.update_time,t.del_flag,t.version,t1.city,t1.address
  FROM user  t    LEFT JOIN address t1 ON (t1.user_id = t.id AND t1.del_flag=0)  
 
 WHERE  t.del_flag=0


AND (t.name = ?)
### Cause: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Failed to process, Error SQL: SELECT    
t.id,t.name,t.age,t.email,t.dept_id,t.create_by,t.update_by,t.create_time,t.update_time,t.del_flag,t.version,t1.city,t1.address
  FROM user  t    LEFT JOIN address t1 ON (t1.user_id = t.id AND t1.del_flag=0)  
 
 WHERE  t.del_flag=0


AND (t.name = ?)] with root cause

net.sf.jsqlparser.parser.ParseException: Encountered unexpected token: "AND" "AND"
    at line 8, column 1.

Was expecting:

    <EOF>

	at net.sf.jsqlparser.parser.CCJSqlParser.generateParseException(CCJSqlParser.java:39603)
	at net.sf.jsqlparser.parser.CCJSqlParser.jj_consume_token(CCJSqlParser.java:39427)
	at net.sf.jsqlparser.parser.CCJSqlParser.Statement(CCJSqlParser.java:317)
	at net.sf.jsqlparser.parser.CCJSqlParserUtil$1.call(CCJSqlParserUtil.java:339)
	at net.sf.jsqlparser.parser.CCJSqlParserUtil$1.call(CCJSqlParserUtil.java:336)
@yulichang
Copy link
Owner

最好提供复现工程

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants