From 06c2653afafc14fac832ba7ba39624b040d39ec5 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周三, 07 5月 2025 11:13:18 +0800
Subject: [PATCH] //去重操作                 columnList = columnList.GroupBy(p => p.ColumnName).Select(g => g.First()).ToList();

---
 Weben_CMS专用代码生成器/Code/DataBaseFactory/Default/MySqlDataBaseServiceHandle.cs |    6 ++++--
 Weben_CMS专用代码生成器/Code/App.config                                            |    9 +++++----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/App.config" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/App.config"
index 2f3c821..25af00c 100644
--- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/App.config"
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/App.config"
@@ -2,8 +2,9 @@
 <configuration>
   <connectionStrings>
     <add name="鏈湴_MySql_CMS" connectionString="Server=localhost;Database=07a6b2f4bbb04e8bb23a9f17a4a769c2_project;Uid=root;Pwd=123abc.com;" />
-	<add name="ZS_鏈湴WmsMysql" connectionString="Server=localhost;Database=cms.plugin.hiawms;Uid=root;Pwd=123abc.com;" />
-    <add name="LA22012_姝︽眽鐗ч噹_鐢熶骇搴揰浼熸湰鐜" connectionString="Data Source=10.10.40.166;Initial Catalog=WHMY_Prod_Test;Persist Security Info=True;User ID=sa;Password=123abc.com" />
+	  <add name="ZS_鏈湴WmsMysql" connectionString="Server=localhost;Database=cms.plugin.hiawms;Uid=root;Pwd=123abc.com;" />
+    <add name="Shao_鏈湴WmsMysql" connectionString="Server=localhost;Database=cms.plugin.hiawms;Uid=root;Pwd=123abc.com;" />
+    <!--  <add name="LA22012_姝︽眽鐗ч噹_鐢熶骇搴揰浼熸湰鐜" connectionString="Data Source=10.10.40.166;Initial Catalog=WHMY_Prod_Test;Persist Security Info=True;User ID=sa;Password=123abc.com" /> 
     <add name="LA22012_姝︽眽鐗ч噹_鐢熶骇搴揰26娴嬭瘯鐜" connectionString="Data Source=172.27.96.26;Initial Catalog=WHMY_Prod_Test;Persist Security Info=True;User ID=sa;Password=MJC!2022@wms" />
     <add name="LA22012_姝︽眽鐗ч噹_澶囦欢搴揰浼熸湰鐜" connectionString="Data Source=10.10.40.166;Initial Catalog=WHMY_Admin.NET;Persist Security Info=True;User ID=sa;Password=123abc.com" />
     <add name="LA22012_姝︽眽鐗ч噹_澶囦欢搴揰26娴嬭瘯鐜" connectionString="Data Source=172.27.96.26;Initial Catalog=WHMY_Admin.NET;Persist Security Info=True;User ID=sa;Password=MJC!2022@wms" />
@@ -11,8 +12,8 @@
     <add name="LA21030_姝︽眽鐗ч噹_鏈湴" connectionString="Data Source=localhost;Initial Catalog=WHMY_Admin.NET;Persist Security Info=True;User ID=sa;Password=123abc.com" />
     <add name="LA18032_AoSinWms_浜�" connectionString="Data Source=120.53.244.200;Initial Catalog=LA18032_AoSinWms;Persist Security Info=True;User ID=sa;Password=123abc.com" />
     <add name="GSiemens_LES" connectionString="Data Source=localhost;Initial Catalog=GSiemens_LES;Persist Security Info=True;User ID=sa;Password=123abc.com" />
-    <add name="GSiemens_WIP" connectionString="Data Source=.;Initial Catalog=GSiemens_WIP;Persist Security Info=True;User ID=sa;Password=123abc.com" />
-    <add name="LocalhostConn" connectionString="Data Source=shaocx;Initial Catalog=SOADB;User ID=sa;Password=1111" />
+    <add name="GSiemens_WIP" connectionString="Data Source=.;Initial Catalog=GSiemens_WIP;Persist Security Info=True;User ID=sa;Password=123abc.com" /> 
+    <add name="LocalhostConn" connectionString="Data Source=shaocx;Initial Catalog=SOADB;User ID=sa;Password=1111" /> -->
   </connectionStrings>
 <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /></startup>
   <runtime>
diff --git "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/DataBaseFactory/Default/MySqlDataBaseServiceHandle.cs" "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/DataBaseFactory/Default/MySqlDataBaseServiceHandle.cs"
index 5063f04..109f9ab 100644
--- "a/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/DataBaseFactory/Default/MySqlDataBaseServiceHandle.cs"
+++ "b/Weben_CMS\344\270\223\347\224\250\344\273\243\347\240\201\347\224\237\346\210\220\345\231\250/Code/DataBaseFactory/Default/MySqlDataBaseServiceHandle.cs"
@@ -15,7 +15,7 @@
             //string strSql = $"SELECT COLUMN_NAME as ColumnName, COLUMN_TYPE as DataType, IS_NULLABLE as IsNullable, CHARACTER_MAXIMUM_LENGTH as DataLength,COLUMN_COMMENT as Description " +
             //                       $"FROM INFORMATION_SCHEMA.COLUMNS " +
             //                       $"WHERE  TABLE_NAME = '{tableName}'";
-            string strSql = $"SELECT DISTINCT c.COLUMN_NAME as ColumnName, c.DATA_TYPE as DataType, c.IS_NULLABLE as IsNullable, c.CHARACTER_MAXIMUM_LENGTH as DataLength, c.COLUMN_COMMENT as Description,c.NUMERIC_SCALE as MyPrecision, " +
+            string strSql = $"SELECT  c.COLUMN_NAME as ColumnName, c.DATA_TYPE as DataType, c.IS_NULLABLE as IsNullable, c.CHARACTER_MAXIMUM_LENGTH as DataLength, c.COLUMN_COMMENT as Description,c.NUMERIC_SCALE as MyPrecision, " +
                 $"CASE WHEN kcu.COLUMN_NAME IS NOT NULL THEN 'true' ELSE 'false' END AS IsPrimaryKey " +
                 $"FROM INFORMATION_SCHEMA.COLUMNS c " +
                 $"LEFT JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE kcu " +
@@ -23,7 +23,7 @@
                 $"AND c.TABLE_NAME = kcu.TABLE_NAME " +
                 $"AND c.COLUMN_NAME = kcu.COLUMN_NAME " +
                 $"AND kcu.CONSTRAINT_NAME = 'PRIMARY' " +
-                $"WHERE c.TABLE_NAME = '{tableName}'"+
+                $"WHERE c.TABLE_NAME = '{tableName}'" +
                 $"ORDER BY c.ORDINAL_POSITION";
 
 
@@ -32,6 +32,8 @@
             {
                 DataSet ds = MySqlHelper.Query(connStr, strSql);
                 columnList = DataTableToList(ds.Tables[0]);
+                //鍘婚噸鎿嶄綔
+                columnList = columnList.GroupBy(p => p.ColumnName).Select(g => g.First()).ToList();
             }
             catch
             {

--
Gitblit v1.9.3