From 55bf797dcc730b37bc691ebab2b51ff9db8ed245 Mon Sep 17 00:00:00 2001 From: zs <zhousong@weben-smart.com> Date: 周二, 06 5月 2025 17:37:23 +0800 Subject: [PATCH] 修改代码样式 --- Weben_CMS专用代码生成器/Code/DataBaseFactory/Default/MySqlDataBaseServiceHandle.cs | 7 ++++--- 1 files changed, 4 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 dd5992e..b16eca7 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.DATA_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>(); @@ -77,7 +78,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