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

租户插件使用 exists 语句会失效 #6139

Closed
no-shutdown opened this issue May 7, 2024 · 1 comment
Closed

租户插件使用 exists 语句会失效 #6139

no-shutdown opened this issue May 7, 2024 · 1 comment
Milestone

Comments

@no-shutdown
Copy link

no-shutdown commented May 7, 2024

当前使用版本
3.5.5、3.5.6 都试过

当前环境信息
例如: Java11 + Mysql5.7

描述bug现象
租户插件使用 exists 语句会失效

场景一:

@Select("select 1 from user userT where idNo = #{loginAccount} limit 1") Integer test1(String loginAccount);

==> Preparing: SELECT 1 FROM user userT WHERE idNo = ? AND userT.tenantId = 0 LIMIT 1
==> Parameters: 445281199999995665(String)
<== Total: 0

场景二:
使用exists不会添加tenantId字段的筛选:
@Select("select exists(select 1 from user userT where idNo = #{loginAccount} limit 1)") Boolean test2(String loginAccount);

==> Preparing: SELECT EXISTS (SELECT 1 FROM user userT WHERE idNo = ? LIMIT 1)
==> Parameters: 445281199999995665(String)
<== Columns: EXISTS (SELECT 1 FROM user userT WHERE idNo = '445281199999995665' LIMIT 1)
<== Row: 1
<== Total: 1

提供问题复现步骤
租户插件,使用select exists语句查询,exists语句内的sql不会增加tenantId字段的筛选

@nieqiurong nieqiurong added this to the 3.5.7 milestone May 8, 2024
@nieqiurong
Copy link
Contributor

用 3.5.7-SNAPSHOT 试试

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