Преглед изворни кода

!1587 修复按库获取表列表时,获取到非本库表的bug
Merge pull request !1587 from 喵你个汪/next

zuohuaijun пре 1 година
родитељ
комит
a23d18bb38
1 измењених фајлова са 4 додато и 0 уклоњено
  1. 4 0
      Admin.NET/Admin.NET.Core/Service/CodeGen/SysCodeGenService.cs

+ 4 - 0
Admin.NET/Admin.NET.Core/Service/CodeGen/SysCodeGenService.cs

@@ -152,6 +152,10 @@ public class SysCodeGenService : IDynamicApiController, ITransient
         var tableOutputList = new List<TableOutput>();
         foreach (var item in entityInfos)
         {
+            var tbConfigId = item.Type.GetCustomAttribute<TenantAttribute>()?.configId as string ?? SqlSugarConst.MainConfigId ;
+            if (item.Type.IsDefined(typeof(LogTableAttribute))) tbConfigId = SqlSugarConst.LogConfigId;
+            if (tbConfigId != configId) continue;
+            
             var table = dbTableInfos.FirstOrDefault(u => string.Equals(u.Name, (config!.DbSettings.EnableUnderLine ? UtilMethods.ToUnderLine(item.DbTableName) : item.DbTableName), StringComparison.CurrentCultureIgnoreCase));
             if (table == null) continue;
             tableOutputList.Add(new TableOutput