Explorar el Código

fix: 修复获取不到非主库字段列表的bug

喵你个旺呀 hace 1 año
padre
commit
05c83aee62
Se han modificado 1 ficheros con 3 adiciones y 3 borrados
  1. 3 3
      Admin.NET/Admin.NET.Core/Service/CodeGen/CustomViewEngine.cs

+ 3 - 3
Admin.NET/Admin.NET.Core/Service/CodeGen/CustomViewEngine.cs

@@ -77,11 +77,11 @@ public class CustomViewEngine : ViewEngineModel
 
         // 获取实体类型属性
         var entityType = provider.DbMaintenance.GetTableInfoList().FirstOrDefault(u => u.Name == tableName);
-
+        
         // 因为ConfigId的表通常也会用到主库的表来做连接,所以这里如果在ConfigId中找不到实体也尝试一下在主库中查找
-        if (ConfigId == SqlSugarConst.MainConfigId && entityType == null) return null;
-        if (ConfigId != SqlSugarConst.MainConfigId)
+        if (entityType == null)
         {
+            if (ConfigId == SqlSugarConst.MainConfigId) return null;
             provider = _db.AsTenant().GetConnectionScope(SqlSugarConst.MainConfigId);
             entityType = provider.DbMaintenance.GetTableInfoList().FirstOrDefault(u => u.Name == tableName);
             if (entityType == null) return null;