多表联查sql LEFT JOIN ON后取消自动拼接 and tenant_id = 000000

Blade 未结 2 1419
1766394880
1766394880 2021-01-19 14:41

一、该问题的重现步骤是什么?

1. 

00000租户是超级管理员,多表联查如何取消LEFT JOIN ON 后追加的AND


2. 

3.


二、你期待的结果是什么?实际看到的又是什么?

不追加tenant_id

三、你正在使用的是什么产品,什么版本?在什么操作系统上?

企业版,win10 

四、请提供详细的错误堆栈信息,这很重要。

2021-01-19 14:25:11.113 DEBUG 14916 --- [  XNIO-1 task-3] o.s.core.tenant.BladeTenantSqlParser     : parser sql: SELECT bt.tenant_id AS tenantId, bt.tenant_name AS tenantName, wte.tenant_brife_name AS tenant_brife_name, wte.company_code AS company_code, bt.linkman AS linkman, wte.linkman_phone AS linkman_phone, wte.linkman_email AS linkman_email, wte.tenant_type AS tenantType, bt.status AS status, bt.create_time AS create_time FROM whistle_tenant_nexus wtn LEFT JOIN blade_tenant bt ON wtn.tenant_id = bt.tenant_id LEFT JOIN whistle_tenant_expand wte ON bt.tenant_id = wte.tenant_id AND wte.tenant_id = '000000' LEFT JOIN whistle_tenant_settle wts ON wte.tenant_id = wts.tenant_id AND wts.tenant_id = '000000' WHERE 0 = 0 AND wte.type = ? AND wtn.parent_tenant_id = ? AND bt.is_deleted = 0 AND wtn.tenant_id = '000000'

2021-01-19 14:25:11.117 DEBUG 14916 --- [  XNIO-1 task-3] o.s.s.m.W.getTenantList                  : ==>  Preparing: SELECT COUNT(1) FROM whistle_tenant_nexus wtn LEFT JOIN blade_tenant bt ON wtn.tenant_id = bt.tenant_id LEFT JOIN whistle_tenant_expand wte ON bt.tenant_id = wte.tenant_id AND wte.tenant_id = '000000' LEFT JOIN whistle_tenant_settle wts ON wte.tenant_id = wts.tenant_id AND wts.tenant_id = '000000' WHERE 0 = 0 AND wte.type = ? AND wtn.parent_tenant_id = ? AND bt.is_deleted = 0 AND wtn.tenant_id = '000000' 

五、若有更多详细信息,请在下面提供。

2条回答
  •  admin
    admin (楼主)
    2021-01-19 15:10

    请问你使用的版本是?新版本的租户插件已经不会对超管进行过滤了

    具体实现逻辑如下,你可以查看下自己对应版本的BladeX-Tool是否有这段逻辑:

    如果有这段逻辑还是不行的话,麻烦把相关代码精简一份然后打个压缩包传到帖子内,我会下载后本地帮你调试下看看

    image.png

    image.png

提交回复