From a3686cfa49bf53fb91a2ceb960cf15b3ebdac641 Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期四, 30 五月 2024 16:38:00 +0800
Subject: [PATCH] 测试代码

---
 smart-starter-tenant/src/main/java/com/qianwen/core/tenant/BladeTenantHandler.java |   60 ++++++++++++++++++++++++++++++------------------------------
 1 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/smart-starter-tenant/src/main/java/com/qianwen/core/tenant/BladeTenantHandler.java b/smart-starter-tenant/src/main/java/com/qianwen/core/tenant/BladeTenantHandler.java
index 5bdd89f..dd16a69 100644
--- a/smart-starter-tenant/src/main/java/com/qianwen/core/tenant/BladeTenantHandler.java
+++ b/smart-starter-tenant/src/main/java/com/qianwen/core/tenant/BladeTenantHandler.java
@@ -6,7 +6,6 @@
 import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import net.sf.jsqlparser.expression.Expression;
@@ -21,10 +20,9 @@
 import org.springframework.beans.factory.SmartInitializingSingleton;
 import org.springframework.context.ApplicationContext;
 
-/* loaded from: blade-starter-tenant-9.3.0.0-SNAPSHOT.jar:org/springblade/core/tenant/BladeTenantHandler.class */
 public class BladeTenantHandler implements TenantLineHandler, SmartInitializingSingleton {
     private static final Logger log = LoggerFactory.getLogger(BladeTenantHandler.class);
-    private final List<String> tenantTableList = new ArrayList();
+    private final List<String> tenantTableList = new ArrayList<>();
     private final List<String> excludeTableList = Arrays.asList("blade_user", "blade_dept", "blade_role", "blade_tenant", "act_de_model");
     private final BladeTenantProperties tenantProperties;
 
@@ -41,37 +39,39 @@
     }
 
     public boolean ignoreTable(String tableName) {
+    	if (BladeTenantHolder.isIgnore().booleanValue()) {
+    	      return true; 
+    	}
+    	return (!this.tenantTableList.contains(tableName) || !StringUtil.isNotBlank(AuthUtil.getTenantId()));
+    	    /*
         return (!BladeTenantHolder.isIgnore().booleanValue() && this.tenantTableList.contains(tableName) && StringUtil.isNotBlank(AuthUtil.getTenantId())) ? false : true;
+        */
     }
 
     public void afterSingletonsInstantiated() {
         ApplicationContext context = SpringUtil.getContext();
-        if (this.tenantProperties.getAnnotationExclude().booleanValue() && context != null) {
-            Map<String, Object> tables = context.getBeansWithAnnotation(TableExclude.class);
-            List<String> excludeTables = this.tenantProperties.getExcludeTables();
-            for (Object o : tables.values()) {
-                TableExclude annotation = (TableExclude) o.getClass().getAnnotation(TableExclude.class);
-                String value = annotation.value();
-                excludeTables.add(value);
-            }
-        }
-        List<TableInfo> tableInfos = TableInfoHelper.getTableInfos();
-        for (TableInfo tableInfo : tableInfos) {
-            String tableName = tableInfo.getTableName();
-            if (!this.tenantProperties.getExcludeTables().contains(tableName) && !this.excludeTableList.contains(tableName.toLowerCase()) && !this.excludeTableList.contains(tableName.toUpperCase())) {
-                List<TableFieldInfo> fieldList = tableInfo.getFieldList();
-                Iterator<TableFieldInfo> it = fieldList.iterator();
-                while (true) {
-                    if (it.hasNext()) {
-                        TableFieldInfo fieldInfo = it.next();
-                        String column = fieldInfo.getColumn();
-                        if (this.tenantProperties.getColumn().equals(column)) {
-                            this.tenantTableList.add(tableName);
-                            break;
-                        }
-                    }
-                }
-            }
-        }
+		if (this.tenantProperties.getAnnotationExclude().booleanValue() && context != null) {
+			Map<String, Object> tables = context.getBeansWithAnnotation(TableExclude.class);
+			List<String> excludeTables = this.tenantProperties.getExcludeTables();
+			for (Object o : tables.values()) {
+				TableExclude annotation = o.getClass().<TableExclude>getAnnotation(TableExclude.class);
+				String value = annotation.value();
+				excludeTables.add(value);
+			}
+		}
+		List<TableInfo> tableInfos = TableInfoHelper.getTableInfos();
+		for (TableInfo tableInfo : tableInfos) {
+			String tableName = tableInfo.getTableName();
+			if (this.tenantProperties.getExcludeTables().contains(tableName)
+					|| this.excludeTableList.contains(tableName.toLowerCase())
+					|| this.excludeTableList.contains(tableName.toUpperCase()))
+				continue;
+			List<TableFieldInfo> fieldList = tableInfo.getFieldList();
+			for (TableFieldInfo fieldInfo : fieldList) {
+				String column = fieldInfo.getColumn();
+				if (this.tenantProperties.getColumn().equals(column))
+					this.tenantTableList.add(tableName);
+			}
+		}
     }
 }

--
Gitblit v1.9.3