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
40745689
Commit
40745689
authored
Sep 08, 2023
by
陈航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【编号:13356】模型生成工具
parent
4e8dcd77
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
714 additions
and
28 deletions
+714
-28
Tools.exe.config
AppHome/Tools.exe.config
+5
-20
links.xml
AppHome/config/links.xml
+6
-0
wEditBasic.Designer.cs
Tools/MyCommon/wEditBasic.Designer.cs
+3
-2
Tools.csproj
Tools/Tools.csproj
+9
-0
wAutoClass.cs
Tools/UI/wAutoClass.cs
+9
-6
wAutoModel.Designer.cs
Tools/UI/wAutoModel.Designer.cs
+185
-0
wAutoModel.cs
Tools/UI/wAutoModel.cs
+85
-0
wAutoModel.resx
Tools/UI/wAutoModel.resx
+411
-0
wExtend.cs
Tools/wExtend.cs
+1
-0
No files found.
AppHome/Tools.exe.config
View file @
40745689
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
configuration
>
<
appSettings
>
<
add
key
=
"UpdateTime"
value
=
"2021-12-30 10:52:06.703"
/>
<
add
key
=
"ExceptFiles"
value
=
""
/>
<
add
key
=
"ContainFiles"
value
=
""
/>
<
add
key
=
"PatchTimeFrame_Dll"
value
=
"48"
/>
<
add
key
=
"PatchTimeFrame_Sql"
value
=
"720"
/>
<
add
key
=
"PatchTimeFrame_Xml"
value
=
"720"
/>
<
add
key
=
"Exclude_PDB"
value
=
"1"
/>
</
appSettings
>
<
startup
>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.8"
/>
</
startup
>
<
startup
>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.8"
/>
</
startup
>
<
runtime
>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
dependentAssembly
>
...
...
@@ -19,11 +10,5 @@
<
bindingRedirect
oldVersion
=
"0.0.0.0-1.3.2.10"
newVersion
=
"1.3.2.10"
/>
</
dependentAssembly
>
</
assemblyBinding
>
<
assemblyBinding
xmlns
=
"urn:schemas-microsoft-com:asm.v1"
>
<
dependentAssembly
>
<
assemblyIdentity
name
=
"Newtonsoft.Json"
publicKeyToken
=
"30ad4fe6b2a6aeed"
culture
=
"neutral"
/>
<
bindingRedirect
oldVersion
=
"0.0.0.0-12.0.0.0"
newVersion
=
"12.0.0.0"
/>
</
dependentAssembly
>
</
assemblyBinding
>
</
runtime
>
</
configuration
>
\ No newline at end of file
</
configuration
>
AppHome/config/links.xml
View file @
40745689
...
...
@@ -168,4 +168,10 @@
<UserId>
sa
</UserId>
<Pwd>
a*1
</Pwd>
</links>
<links>
<Link>
192.168.1.204
</Link>
<DbName>
ln_pdm20230822
</DbName>
<UserId>
sa
</UserId>
<Pwd>
sa
</Pwd>
</links>
</DocumentElement>
\ No newline at end of file
Tools/MyCommon/wEditBasic.Designer.cs
View file @
40745689
...
...
@@ -33,10 +33,11 @@
//
// wEditBasic
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
6F
,
12
F
);
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
7F
,
17
F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
384
,
268
);
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
448
,
380
);
this
.
Icon
=
((
System
.
Drawing
.
Icon
)(
resources
.
GetObject
(
"$this.Icon"
)));
this
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
5
,
6
,
5
,
6
);
this
.
Name
=
"wEditBasic"
;
this
.
Text
=
"wEditBasic"
;
this
.
ResumeLayout
(
false
);
...
...
Tools/Tools.csproj
View file @
40745689
...
...
@@ -154,6 +154,12 @@
<Compile
Include=
"UI\sys\wToolsPrief.Designer.cs"
>
<DependentUpon>
wToolsPrief.cs
</DependentUpon>
</Compile>
<Compile
Include=
"UI\wAutoModel.cs"
>
<SubType>
Form
</SubType>
</Compile>
<Compile
Include=
"UI\wAutoModel.Designer.cs"
>
<DependentUpon>
wAutoModel.cs
</DependentUpon>
</Compile>
<Compile
Include=
"UI\wCefDemo.cs"
>
<SubType>
Form
</SubType>
</Compile>
...
...
@@ -407,6 +413,9 @@
<EmbeddedResource
Include=
"UI\sys\wToolsPrief.resx"
>
<DependentUpon>
wToolsPrief.cs
</DependentUpon>
</EmbeddedResource>
<EmbeddedResource
Include=
"UI\wAutoModel.resx"
>
<DependentUpon>
wAutoModel.cs
</DependentUpon>
</EmbeddedResource>
<EmbeddedResource
Include=
"UI\wCefDemo.resx"
>
<DependentUpon>
wCefDemo.cs
</DependentUpon>
</EmbeddedResource>
...
...
Tools/UI/wAutoClass.cs
View file @
40745689
...
...
@@ -95,11 +95,14 @@ namespace Tools.UI
string
strTableName
=
lsbTableInfo
.
SelectedItem
.
ToString
();
StringBuilder
sb
=
new
StringBuilder
();
sb
.
AppendLine
(
$@"
SELECT b.name,b.user_type_id,c.name as TypeName 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
WHERE a.name='
{
strTableName
}
' ORDER BY b.column_id
sb
.
AppendLine
(
$@"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 = '
{
strTableName
}
'
ORDER BY b.column_id;
"
);
DataTable
dataTable
=
this
.
_db
.
GetDataTable
(
sb
.
ToString
(),
"结果列表"
);
...
...
@@ -115,7 +118,7 @@ WHERE a.name='{strTableName}' ORDER BY b.column_id
{
sb
.
Append
(
$@"
/// <summary>
///
{
row
[
"
name
"
]}
///
{
row
[
"
Description
"
]}
/// </summary>
public
{
GetCsharpTypeNameBySqlType
(
row
[
"TypeName"
].
ToString
())}
{
row
[
"name"
]}
{{
get
;
set
;
}}
"
);
...
...
Tools/UI/wAutoModel.Designer.cs
0 → 100644
View file @
40745689
namespace
Tools.UI
{
partial
class
wAutoModel
{
/// <summary>
/// Required designer variable.
/// </summary>
private
System
.
ComponentModel
.
IContainer
components
=
null
;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected
override
void
Dispose
(
bool
disposing
)
{
if
(
disposing
&&
(
components
!=
null
))
{
components
.
Dispose
();
}
base
.
Dispose
(
disposing
);
}
#
region
Windows
Form
Designer
generated
code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private
void
InitializeComponent
()
{
System
.
ComponentModel
.
ComponentResourceManager
resources
=
new
System
.
ComponentModel
.
ComponentResourceManager
(
typeof
(
wAutoModel
));
this
.
splitContainer1
=
new
System
.
Windows
.
Forms
.
SplitContainer
();
this
.
panel4
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
txtdate
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
panel3
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
label2
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
label1
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
txtResult
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
toolStrip1
=
new
System
.
Windows
.
Forms
.
ToolStrip
();
this
.
tsbentity
=
new
System
.
Windows
.
Forms
.
ToolStripButton
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
splitContainer1
)).
BeginInit
();
this
.
splitContainer1
.
Panel1
.
SuspendLayout
();
this
.
splitContainer1
.
Panel2
.
SuspendLayout
();
this
.
splitContainer1
.
SuspendLayout
();
this
.
panel4
.
SuspendLayout
();
this
.
panel3
.
SuspendLayout
();
this
.
toolStrip1
.
SuspendLayout
();
this
.
SuspendLayout
();
//
// splitContainer1
//
this
.
splitContainer1
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
splitContainer1
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
25
);
this
.
splitContainer1
.
Name
=
"splitContainer1"
;
//
// splitContainer1.Panel1
//
this
.
splitContainer1
.
Panel1
.
Controls
.
Add
(
this
.
panel4
);
this
.
splitContainer1
.
Panel1
.
Controls
.
Add
(
this
.
panel3
);
//
// splitContainer1.Panel2
//
this
.
splitContainer1
.
Panel2
.
Controls
.
Add
(
this
.
txtResult
);
this
.
splitContainer1
.
Size
=
new
System
.
Drawing
.
Size
(
657
,
545
);
this
.
splitContainer1
.
SplitterDistance
=
159
;
this
.
splitContainer1
.
SplitterWidth
=
10
;
this
.
splitContainer1
.
TabIndex
=
0
;
//
// panel4
//
this
.
panel4
.
Controls
.
Add
(
this
.
txtdate
);
this
.
panel4
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
panel4
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
19
);
this
.
panel4
.
Name
=
"panel4"
;
this
.
panel4
.
Size
=
new
System
.
Drawing
.
Size
(
159
,
526
);
this
.
panel4
.
TabIndex
=
4
;
//
// txtdate
//
this
.
txtdate
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
txtdate
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
txtdate
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
3
,
4
,
3
,
4
);
this
.
txtdate
.
Multiline
=
true
;
this
.
txtdate
.
Name
=
"txtdate"
;
this
.
txtdate
.
ScrollBars
=
System
.
Windows
.
Forms
.
ScrollBars
.
Both
;
this
.
txtdate
.
Size
=
new
System
.
Drawing
.
Size
(
159
,
526
);
this
.
txtdate
.
TabIndex
=
2
;
//
// panel3
//
this
.
panel3
.
BorderStyle
=
System
.
Windows
.
Forms
.
BorderStyle
.
FixedSingle
;
this
.
panel3
.
Controls
.
Add
(
this
.
label2
);
this
.
panel3
.
Controls
.
Add
(
this
.
label1
);
this
.
panel3
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Top
;
this
.
panel3
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
panel3
.
Name
=
"panel3"
;
this
.
panel3
.
Size
=
new
System
.
Drawing
.
Size
(
159
,
19
);
this
.
panel3
.
TabIndex
=
3
;
//
// label2
//
this
.
label2
.
AutoSize
=
true
;
this
.
label2
.
Location
=
new
System
.
Drawing
.
Point
(
90
,
1
);
this
.
label2
.
Name
=
"label2"
;
this
.
label2
.
Size
=
new
System
.
Drawing
.
Size
(
32
,
17
);
this
.
label2
.
TabIndex
=
2
;
this
.
label2
.
Text
=
"描述"
;
//
// label1
//
this
.
label1
.
AutoSize
=
true
;
this
.
label1
.
Location
=
new
System
.
Drawing
.
Point
(
17
,
1
);
this
.
label1
.
Name
=
"label1"
;
this
.
label1
.
Size
=
new
System
.
Drawing
.
Size
(
44
,
17
);
this
.
label1
.
TabIndex
=
1
;
this
.
label1
.
Text
=
"字段名"
;
//
// txtResult
//
this
.
txtResult
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
txtResult
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
txtResult
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
3
,
4
,
3
,
4
);
this
.
txtResult
.
Multiline
=
true
;
this
.
txtResult
.
Name
=
"txtResult"
;
this
.
txtResult
.
ScrollBars
=
System
.
Windows
.
Forms
.
ScrollBars
.
Both
;
this
.
txtResult
.
Size
=
new
System
.
Drawing
.
Size
(
488
,
545
);
this
.
txtResult
.
TabIndex
=
1
;
//
// toolStrip1
//
this
.
toolStrip1
.
Items
.
AddRange
(
new
System
.
Windows
.
Forms
.
ToolStripItem
[]
{
this
.
tsbentity
});
this
.
toolStrip1
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
toolStrip1
.
Name
=
"toolStrip1"
;
this
.
toolStrip1
.
Size
=
new
System
.
Drawing
.
Size
(
657
,
25
);
this
.
toolStrip1
.
TabIndex
=
1
;
this
.
toolStrip1
.
Text
=
"toolStrip1"
;
//
// tsbentity
//
this
.
tsbentity
.
Image
=
global
::
Tools
.
Properties
.
Resources
.
实体类
;
this
.
tsbentity
.
ImageTransparentColor
=
System
.
Drawing
.
Color
.
Magenta
;
this
.
tsbentity
.
Name
=
"tsbentity"
;
this
.
tsbentity
.
Size
=
new
System
.
Drawing
.
Size
(
88
,
22
);
this
.
tsbentity
.
Text
=
"生成实体类"
;
this
.
tsbentity
.
Click
+=
new
System
.
EventHandler
(
this
.
tsbentity_Click
);
//
// wAutoModel
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
7F
,
17F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
657
,
570
);
this
.
Controls
.
Add
(
this
.
splitContainer1
);
this
.
Controls
.
Add
(
this
.
toolStrip1
);
this
.
Icon
=
((
System
.
Drawing
.
Icon
)(
resources
.
GetObject
(
"$this.Icon"
)));
this
.
Name
=
"wAutoModel"
;
this
.
Text
=
"模型生成工具"
;
this
.
splitContainer1
.
Panel1
.
ResumeLayout
(
false
);
this
.
splitContainer1
.
Panel2
.
ResumeLayout
(
false
);
this
.
splitContainer1
.
Panel2
.
PerformLayout
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
splitContainer1
)).
EndInit
();
this
.
splitContainer1
.
ResumeLayout
(
false
);
this
.
panel4
.
ResumeLayout
(
false
);
this
.
panel4
.
PerformLayout
();
this
.
panel3
.
ResumeLayout
(
false
);
this
.
panel3
.
PerformLayout
();
this
.
toolStrip1
.
ResumeLayout
(
false
);
this
.
toolStrip1
.
PerformLayout
();
this
.
ResumeLayout
(
false
);
this
.
PerformLayout
();
}
#
endregion
private
System
.
Windows
.
Forms
.
SplitContainer
splitContainer1
;
private
System
.
Windows
.
Forms
.
Panel
panel4
;
private
System
.
Windows
.
Forms
.
TextBox
txtdate
;
private
System
.
Windows
.
Forms
.
Panel
panel3
;
private
System
.
Windows
.
Forms
.
Label
label2
;
private
System
.
Windows
.
Forms
.
Label
label1
;
private
System
.
Windows
.
Forms
.
TextBox
txtResult
;
private
System
.
Windows
.
Forms
.
ToolStrip
toolStrip1
;
private
System
.
Windows
.
Forms
.
ToolStripButton
tsbentity
;
}
}
\ No newline at end of file
Tools/UI/wAutoModel.cs
0 → 100644
View file @
40745689
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Data
;
using
System.Drawing
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
using
Tools.MyCommon
;
namespace
Tools.UI
{
public
partial
class
wAutoModel
:
wEditBasic
{
public
wAutoModel
()
{
InitializeComponent
();
}
/// <summary>
/// 生成实体类
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private
void
tsbentity_Click
(
object
sender
,
EventArgs
e
)
{
try
{
// 获取粘贴的字段名和描述内容
string
clipboardText
=
txtdate
.
Text
;
// 将字段名和描述按行分割
string
[]
lines
=
clipboardText
.
Split
(
'\n'
);
// 创建实体类代码
StringBuilder
sb
=
new
StringBuilder
();
sb
.
Append
(
$@"
/// <summary>
/// XXXModel
/// </summary>
public class XXXModel
{{
");
// 遍历每一行
foreach
(
string
line
in
lines
)
{
if
(!
string
.
IsNullOrEmpty
(
line
))
{
// 将行内容按制表符分割为字段名和描述
string
[]
parts
=
line
.
Split
(
'\t'
);
if
(
parts
.
Length
>=
2
)
{
string
fieldName
=
parts
[
0
].
Trim
();
string
fieldDescription
=
parts
[
1
].
Trim
();
sb
.
Append
(
$@"
/// <summary>
///
{
fieldDescription
}
/// </summary>
public string
{
fieldName
}
{{
get
;
set
;
}}
"
);
}
}
}
sb
.
Append
(
$@"
}}
"
);
// 将实体类代码输出到右侧的 TextBox
txtResult
.
Text
=
sb
.
ToString
();
sb
.
Clear
();
}
catch
(
Exception
ex
)
{
// 处理异常
MessageBox
.
Show
(
"发生错误:"
+
ex
.
Message
);
}
}
}
}
Tools/UI/wAutoModel.resx
0 → 100644
View file @
40745689
This diff is collapsed.
Click to expand it.
Tools/wExtend.cs
View file @
40745689
...
...
@@ -61,6 +61,7 @@ namespace Tools
this
.
CreateModule
(
Tools_dev
,
typeof
(
UI
.
wDbAnlysis
),
"SQL效率分析"
,
"tr:用于分析SQL查询效率(执行计划和IO计数)"
),
this
.
CreateModule
(
Tools_dev
,
typeof
(
UI
.
wSysChecker
),
"检查配置工具"
,
"tr:系统通用检查配置服务(通过存储过程检查)"
),
this
.
CreateModule
(
Tools_dev
,
typeof
(
UI
.
wMuiltTaskSimulate
),
"批量并行任务模拟"
,
"lxj:多线程并行运行指定测试项目,用来做压力性能测试等。。。"
),
this
.
CreateModule
(
Tools_dev
,
typeof
(
UI
.
wAutoModel
),
"模型生成工具"
,
"tb:将Excel字段名、描述复制到指定区域,生成为模型类"
),
//-------------------------------
this
.
CreateModule
(
Tools_human
,
typeof
(
UI
.
wUser
),
"员工管理"
,
"tr:员工状态及头像管理"
),
this
.
CreateModule
(
Tools_human
,
typeof
(
UI
.
wEvaluationOfEmployee
),
"员工考核"
,
"tr:员工考核的记录工具"
),
...
...
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