From 0025d492f22acf84f6db722381b4a54893f6ef29 Mon Sep 17 00:00:00 2001
From: zs <zhousong@weben-smart.com>
Date: 周一, 19 5月 2025 18:03:30 +0800
Subject: [PATCH] Merge branch 'master' of http://222.71.245.114:9086/r/HIA24016N_PipeLineDemo
---
Weben_CMS专用代码生成器/Code/DataBaseFactory/Default/MySqlDataBaseServiceHandle.cs | 9 ++++++---
1 files changed, 6 insertions(+), 3 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/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 0e91efd..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 c.COLUMN_NAME as ColumnName, c.COLUMN_TYPE as DataType, c.IS_NULLABLE as IsNullable, c.CHARACTER_MAXIMUM_LENGTH as DataLength, c.COLUMN_COMMENT as Description, " +
+ 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,8 @@
$"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";
List<ColumnModel> columnList = new List<ColumnModel>();
@@ -31,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
{
@@ -77,7 +80,7 @@
model.Description = dt.Rows[n]["Description"].ToString();
if (dt.Rows[n]["IsNullable"].ToString() != "")
{
- if ((dt.Rows[n]["IsNullable"].ToString() == "1") || (dt.Rows[n]["IsNullable"].ToString().ToLower() == "true"))
+ if ((dt.Rows[n]["IsNullable"].ToString() == "1") || (dt.Rows[n]["IsNullable"].ToString().ToLower() == "true") || (dt.Rows[n]["IsNullable"].ToString().ToLower() == "yes"))
{
model.IsNullable = true;
}
--
Gitblit v1.9.3