Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
Ftt_Common
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Ftt_Common
Commits
d22ff3e0
Commit
d22ff3e0
authored
Sep 26, 2023
by
陈航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【编号:13400】工具平台Xml生成器优化
parent
4e88db7a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
wXmlGenerator.cs
Tools/UI/wXmlGenerator.cs
+47
-0
No files found.
Tools/UI/wXmlGenerator.cs
View file @
d22ff3e0
...
...
@@ -74,6 +74,8 @@ namespace Tools.UI
return
;
//初始化配置信息表
this
.
_dsXmlSetting
=
this
.
InitColumnInfo
(
this
.
_ds
);
//填充字段描述
this
.
_dsXmlSetting
=
AddFieldDescription
(
this
.
_tableName
,
this
.
_dsXmlSetting
);
//绑定数据源
this
.
dgvDetail
.
DataSource
=
this
.
_dsXmlSetting
.
Tables
[
0
].
DefaultView
;
}
...
...
@@ -163,6 +165,51 @@ namespace Tools.UI
});
return
result
;
}
/// <summary>
/// 填充字段描述
/// </summary>
/// <param name="tableName"></param>
/// <returns></returns>
private
DataSet
AddFieldDescription
(
string
tableName
,
DataSet
dataSet
)
{
try
{
//获取字段描述
string
sql
=
$@"SELECT b.name, b.user_type_id, c.name AS TypeName, ISNULL(d.value, b.name) AS Description
FROM sys.objects a
INNER JOIN sys.columns b ON b.object_id = a.object_id
INNER JOIN sys.types c ON b.user_type_id = c.user_type_id
LEFT JOIN sys.extended_properties d ON b.object_id = d.major_id
AND b.column_id = d.minor_id
WHERE a.name = '
{
tableName
}
'
ORDER BY b.column_id;"
;
DataTable
dataTable
=
this
.
_db
.
GetDataTable
(
sql
,
"结果列表"
);
if
(
dataTable
!=
null
||
dataTable
.
Rows
.
Count
>
0
)
{
DataRow
row
=
null
;
foreach
(
DataRow
dr
in
dataSet
.
Tables
[
0
].
Rows
)
{
string
name
=
dr
[
"Name"
].
ToString
();
row
=
dataTable
.
Select
(
$"name='
{
name
}
'"
).
FirstOrDefault
();
if
(
row
!=
null
)
dr
[
"Description"
]
=
row
[
"Description"
].
ToString
();
}
}
}
catch
(
Exception
ex
)
{
Utils
.
Tip
(
$"填充字段描述:有误!:
{
ex
.
Message
}
"
);
}
return
dataSet
;
}
/// <summary>
/// 将XmlDocument转化为string
/// </summary>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment