yulichang / mybatis-plus-join

支持连表查询的mybatis-plus,mybatis-plus风格的连表操作提供wrapper.leftJoin(),wrapper.rightJoin()等操作
https://yulichang.github.io/mybatis-plus-join-doc/
Apache License 2.0
971 stars 113 forks source link

同时设置setEntity和setAlias时生成的sql有误 #120

Closed Arowa-Z closed 1 month ago

Arowa-Z commented 1 month ago

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

1.4.11

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

当使用 MPJLambdaWrapper(T entity, String alias) api时,如果 alias 不为 ConfigProperties.tableAlias 的值时,由 entity 生成的 where 条件 依旧是 ConfigProperties.tableAlias,而 select 中的字段却是 传入的 alias

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

代码: image

报错信息

sql错误部分: image

通过查看生成的xml,判断为根据 entity 所生成的条件表别名写死为 ConfigProperties.tableAlias 的值,未替换为${ew.alias} image

qichangleixin commented 1 month ago

请问下自动生成的xml怎么查看的啊

Arowa-Z commented 1 month ago

请问下自动生成的xml怎么查看的啊

在对应的injectMappedStatement方法里打断点 image

yulichang commented 1 month ago

升级版本