From 807aec33a89dd7ff146d8497e7ebb3c554f1e0f6 Mon Sep 17 00:00:00 2001 From: zhouyx <41593435@qq.com> Date: Sun, 16 Oct 2022 15:06:50 +0800 Subject: [PATCH] =?UTF-8?q?Mysql=E5=88=9B=E5=BB=BA=E8=A1=A8=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=AD=97=E6=AE=B5=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Src/Asp.NetCore2/MySqlTest/Models/Order.cs | 3 ++- .../Realization/MySql/DbMaintenance/MySqlDbMaintenance.cs | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Src/Asp.NetCore2/MySqlTest/Models/Order.cs b/Src/Asp.NetCore2/MySqlTest/Models/Order.cs index d7ff068b8..8e862108d 100644 --- a/Src/Asp.NetCore2/MySqlTest/Models/Order.cs +++ b/Src/Asp.NetCore2/MySqlTest/Models/Order.cs @@ -11,8 +11,9 @@ namespace OrmTest { [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] public int Id { get; set; } - + [SugarColumn(ColumnDescription ="名称")] public string Name { get; set; } + [SugarColumn(ColumnDescription = "价格")] public decimal Price { get; set; } [SugarColumn(IsNullable = true)] public DateTime CreateTime { get; set; } diff --git a/Src/Asp.NetCore2/SqlSugar/Realization/MySql/DbMaintenance/MySqlDbMaintenance.cs b/Src/Asp.NetCore2/SqlSugar/Realization/MySql/DbMaintenance/MySqlDbMaintenance.cs index bc7a6370d..b1d25f431 100644 --- a/Src/Asp.NetCore2/SqlSugar/Realization/MySql/DbMaintenance/MySqlDbMaintenance.cs +++ b/Src/Asp.NetCore2/SqlSugar/Realization/MySql/DbMaintenance/MySqlDbMaintenance.cs @@ -392,6 +392,10 @@ namespace SqlSugar string primaryKey = null; string identity = item.IsIdentity ? this.CreateTableIdentity : null; string addItem = string.Format(this.CreateTableColumn, this.SqlBuilder.GetTranslationColumnName(columnName), dataType, dataSize, nullType, primaryKey, identity); + if (!string.IsNullOrEmpty(item.ColumnDescription)) + { + addItem += "COMMENT '"+item.ColumnDescription+"' "; + } columnArray.Add(addItem); } string tableString = string.Format(this.CreateTableSql, this.SqlBuilder.GetTranslationTableName(tableName), string.Join(",\r\n", columnArray));