浏览代码

!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