tenant_id 在查询语句里拼接 不带表名,多表查询的时候报错

Blade 未结 1 1178
Sum Of Long
Sum Of Long 剑童 2020-07-23 10:59

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

1. 多表查询的时候,tenant_id拼接不对

2. 

3.


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

租户tenant_id自动拼接到sql里的时候可以带上查询主表的表名。

实际上tenant_id拼接没有带上表名


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

bladeX企业版    版本2.5.1  linux系统


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

nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Error: Method queryTotal execution error of sql : SELECT COUNT(1) FROM mit_dealer_product INNER JOIN mit_dealer ON mit_dealer.id = mit_dealer_product.dealer_id INNER JOIN mit_project_data ON mit_project_data.id = mit_dealer_product.project_data_id WHERE mit_dealer_product.is_deleted = 0 AND mit_dealer_product.dealer_id = ? AND tenant_id = '111111' ### The error may exist in file [E:\MIT\PROJECT\CRM\inside_crm_2.5.1\target\classes\org\springblade\crm\dealer\product\mapper\DealerProductMapper.xml] ### The error may involve defaultParameterMap ### The error occurred while setting parameters ### SQL: select mit_dealer_product.id as id ,IFNULL(mit_dealer_product.budget_amount,0) as budgetAmount ,mit_dealer_product.state as state ,mit_dealer_product.create_user as createUser ,mit_dealer_product.create_time as createTime ,mit_dealer_product.dealer_id as dealerId ,mit_dealer_product.project_data_id as projectDataId ,mit_dealer_product.hospital_name as hospitalName ,mit_dealer_product.update_time as updateTime ,mit_dealer.dealer_name as dealerName ,mit_project_data.project_name as projectDataName from mit_dealer_product inner join mit_dealer on mit_dealer.id = mit_dealer_product.dealer_id inner join mit_project_data on mit_project_data.id = mit_dealer_product.project_data_id where mit_dealer_product.is_deleted = 0 and mit_dealer_product.dealer_id = ? ### Cause: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Error: Method queryTotal execution error of sql : SELECT COUNT(1) FROM mit_dealer_product INNER JOIN mit_dealer ON mit_dealer.id = mit_dealer_product.dealer_id INNER JOIN mit_project_data ON mit_project_data.id = mit_dealer_product.project_data_id WHERE mit_dealer_product.is_deleted = 0 AND mit_dealer_product.dealer_id = ? AND tenant_id = '111111'


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

tenant_id = '111111'   期望的结果是mit_dealer_product.tenant_id = '111111'

1条回答
提交回复