mirror of
				https://github.com/YunaiV/ruoyi-vue-pro.git
				synced 2025-11-01 03:28:41 +08:00 
			
		
		
		
	【优化】忽略多租户的表,兼容表名带有包裹符号的情况
利用SqlParserUtils.removeWrapperSymbol(tableName)去掉表名前后的引用符号,比如MySQL的反引号或者SQLServer的中括号 Signed-off-by: zoemak <58775+zoemak@user.noreply.gitee.com>
This commit is contained in:
		| @ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil; | |||||||
| import cn.iocoder.yudao.framework.tenant.config.TenantProperties; | import cn.iocoder.yudao.framework.tenant.config.TenantProperties; | ||||||
| import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; | import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; | ||||||
| import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler; | import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler; | ||||||
|  | import com.baomidou.mybatisplus.extension.toolkit.SqlParserUtils; | ||||||
| import net.sf.jsqlparser.expression.Expression; | import net.sf.jsqlparser.expression.Expression; | ||||||
| import net.sf.jsqlparser.expression.LongValue; | import net.sf.jsqlparser.expression.LongValue; | ||||||
|  |  | ||||||
| @ -37,7 +38,7 @@ public class TenantDatabaseInterceptor implements TenantLineHandler { | |||||||
|     @Override |     @Override | ||||||
|     public boolean ignoreTable(String tableName) { |     public boolean ignoreTable(String tableName) { | ||||||
|         return TenantContextHolder.isIgnore() // 情况一,全局忽略多租户 |         return TenantContextHolder.isIgnore() // 情况一,全局忽略多租户 | ||||||
|             || CollUtil.contains(ignoreTables, tableName); // 情况二,忽略多租户的表 |                || CollUtil.contains(ignoreTables, SqlParserUtils.removeWrapperSymbol(tableName)); // 情况二,忽略多租户的表 | ||||||
|     } |     } | ||||||
|  |  | ||||||
| } | } | ||||||
		Reference in New Issue
	
	Block a user
	 zoemak
					zoemak