Skip to content

Commit

Permalink
修复mysql注释为空的bug
Browse files Browse the repository at this point in the history
添加分类信息
修复数据库目录跳转报错
  • Loading branch information
tshit11 committed Apr 30, 2021
1 parent 442e39a commit 21d8585
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
4 changes: 2 additions & 2 deletions DBChm/CHM/ChmHtmlHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ public static void CreateHtml(List<TryOpenXml.Dtos.TableDto> tables, string tabs
code.AppendLine(" <div class=\"styletab\">{0}</div>{1}{2}".FormatString(
tab.TableName,
"<span style='float: left; margin-top: 6px;font-size:16px;'>" + tab.Comment + "</span>",
"<a href='../数据库表目录.html' style='float: right; margin-top: 6px;font-size:16px;'>返回目录</a>"));
"<a href='../../数据库表目录.html' style='float: right; margin-top: 6px;font-size:16px;'>返回目录</a>"));
code.AppendLine(" </caption>");


Expand Down Expand Up @@ -537,7 +537,7 @@ public static void CreateHtml(Dictionary<string, TableInfo> dictTabs, string tab
code.AppendLine(" <div class=\"styletab\">{0}</div>{1}{2}".FormatString(
tabInfo.TableName,
"<span style='float: left; margin-top: 6px;font-size:16px;'>" + tabInfo.TabComment + "</span>",
"<a href='../数据库表目录.html' style='float: right; margin-top: 6px;font-size:16px;'>返回目录</a>"));
"<a href='../../数据库表目录.html' style='float: right; margin-top: 6px;font-size:16px;'>返回目录</a>"));
code.AppendLine(" </caption>");


Expand Down
10 changes: 0 additions & 10 deletions DBChm/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,3 @@ warden=区长
weikedao=威客道
weixin=微信公众号
yimeiduo=一美多
risk=风控
treasure=夺宝
seckill=秒杀
distributor=分销
groups=拼团
consult=商品咨询
evaluate=评价
index=首页
purchase=采购
special=专题
4 changes: 2 additions & 2 deletions MJTop.Data/DatabaseInfo/MySqlDBInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public bool Refresh()


string dbSql = "SELECT SCHEMA_NAME FROM information_schema.SCHEMATA order by SCHEMA_NAME asc";
string strSql = string.Format("SELECT table_name name,TABLE_COMMENT value FROM INFORMATION_SCHEMA.TABLES WHERE lower(table_type)='base table' and table_schema = '{0}' order by table_name asc ", DBName);
string strSql = string.Format("SELECT table_name name,TRIM(TABLE_COMMENT) value FROM INFORMATION_SCHEMA.TABLES WHERE lower(table_type)='base table' and table_schema = '{0}' order by table_name asc ", DBName);

string viewSql = string.Format("SELECT table_name,VIEW_DEFINITION FROM information_schema.views where TABLE_SCHEMA='{0}' order by table_name asc", DBName);
string procSql = string.Format("SELECT ROUTINE_NAME,ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_SCHEMA='{0}' AND ROUTINE_TYPE='PROCEDURE' ORDER BY ROUTINE_NAME ASC", DBName);
Expand Down Expand Up @@ -135,7 +135,7 @@ public bool Refresh()

//strSql = "SHOW FULL COLUMNS FROM " + tableName;

strSql = @"select ORDINAL_POSITION as Colorder,Column_Name as ColumnName,data_type as TypeName,COLUMN_COMMENT as DeText,
strSql = @"select ORDINAL_POSITION as Colorder,Column_Name as ColumnName,data_type as TypeName,TRIM(COLUMN_COMMENT) as DeText,
(case when data_type = 'float' or data_type = 'double' or data_type = 'decimal' then NUMERIC_PRECISION else CHARACTER_MAXIMUM_LENGTH end ) as length,
(case when data_type = 'int' or data_type = 'bigint' then null else NUMERIC_SCALE end) as Scale,( case when EXTRA='auto_increment' then 1 else 0 end) as IsIdentity,(case when COLUMN_KEY='PRI' then 1 else 0 end) as IsPK,
(case when IS_NULLABLE = 'NO' then 0 else 1 end)as CanNull,COLUMN_DEFAULT as DefaultVal
Expand Down

0 comments on commit 21d8585

Please sign in to comment.