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
2f02f6f2
Commit
2f02f6f2
authored
Jan 06, 2021
by
tr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、模块管理:生成SQL脚本功能(待优化)
parent
002ee8ba
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
127 additions
and
74 deletions
+127
-74
sql.png
Tools/Resources/sql.png
+0
-0
Tools.csproj
Tools/Tools.csproj
+3
-3
wModuleManager.Designer.cs
Tools/UI/wModuleManager.Designer.cs
+64
-53
wModuleManager.cs
Tools/UI/wModuleManager.cs
+59
-1
wModuleManager.resx
Tools/UI/wModuleManager.resx
+1
-17
No files found.
Tools/Resources/sql.png
View replaced file @
002ee8ba
View file @
2f02f6f2
1.15 KB
|
W:
|
H:
725 Bytes
|
W:
|
H:
2-up
Swipe
Onion skin
Tools/Tools.csproj
View file @
2f02f6f2
...
...
@@ -309,9 +309,6 @@
<ItemGroup>
<None
Include=
"Resources\数据库.png"
/>
</ItemGroup>
<ItemGroup>
<None
Include=
"Resources\sql.png"
/>
</ItemGroup>
<ItemGroup>
<None
Include=
"Resources\类.png"
/>
</ItemGroup>
...
...
@@ -361,5 +358,8 @@
<ItemGroup>
<None
Include=
"Resources\删 除.png"
/>
</ItemGroup>
<ItemGroup>
<None
Include=
"Resources\SQL.png"
/>
</ItemGroup>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
</Project>
\ No newline at end of file
Tools/UI/wModuleManager.Designer.cs
View file @
2f02f6f2
...
...
@@ -31,11 +31,6 @@
this
.
components
=
new
System
.
ComponentModel
.
Container
();
System
.
ComponentModel
.
ComponentResourceManager
resources
=
new
System
.
ComponentModel
.
ComponentResourceManager
(
typeof
(
wModuleManager
));
this
.
toolStrip1
=
new
System
.
Windows
.
Forms
.
ToolStrip
();
this
.
tsbAdd
=
new
System
.
Windows
.
Forms
.
ToolStripButton
();
this
.
tsbCopy
=
new
System
.
Windows
.
Forms
.
ToolStripButton
();
this
.
tsbDel
=
new
System
.
Windows
.
Forms
.
ToolStripButton
();
this
.
tsbSave
=
new
System
.
Windows
.
Forms
.
ToolStripButton
();
this
.
tsbDbSetting
=
new
System
.
Windows
.
Forms
.
ToolStripButton
();
this
.
tslDbLinkString
=
new
System
.
Windows
.
Forms
.
ToolStripLabel
();
this
.
splitContainer1
=
new
System
.
Windows
.
Forms
.
SplitContainer
();
this
.
tvModules
=
new
System
.
Windows
.
Forms
.
TreeView
();
...
...
@@ -47,6 +42,7 @@
this
.
dgvDetail
=
new
System
.
Windows
.
Forms
.
DataGridView
();
this
.
cmsDetail
=
new
System
.
Windows
.
Forms
.
ContextMenuStrip
(
this
.
components
);
this
.
tsmiAdd
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
tsmiCopy
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
tsmiDel
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
tsFuncInfo
=
new
System
.
Windows
.
Forms
.
ToolStrip
();
this
.
toolStripLabel2
=
new
System
.
Windows
.
Forms
.
ToolStripLabel
();
...
...
@@ -76,7 +72,12 @@
this
.
ckCanPassLevelReport
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
tbSysCode
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
tbPrevID
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
tsmiCopy
=
new
System
.
Windows
.
Forms
.
ToolStripMenuItem
();
this
.
tsbAdd
=
new
System
.
Windows
.
Forms
.
ToolStripButton
();
this
.
tsbCopy
=
new
System
.
Windows
.
Forms
.
ToolStripButton
();
this
.
tsbDel
=
new
System
.
Windows
.
Forms
.
ToolStripButton
();
this
.
tsbSave
=
new
System
.
Windows
.
Forms
.
ToolStripButton
();
this
.
tsbGenSQL
=
new
System
.
Windows
.
Forms
.
ToolStripButton
();
this
.
tsbDbSetting
=
new
System
.
Windows
.
Forms
.
ToolStripButton
();
this
.
toolStrip1
.
SuspendLayout
();
((
System
.
ComponentModel
.
ISupportInitialize
)(
this
.
splitContainer1
)).
BeginInit
();
this
.
splitContainer1
.
Panel1
.
SuspendLayout
();
...
...
@@ -97,6 +98,7 @@
this
.
tsbCopy
,
this
.
tsbDel
,
this
.
tsbSave
,
this
.
tsbGenSQL
,
this
.
tsbDbSetting
,
this
.
tslDbLinkString
});
this
.
toolStrip1
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
...
...
@@ -105,46 +107,6 @@
this
.
toolStrip1
.
TabIndex
=
0
;
this
.
toolStrip1
.
Text
=
"toolStrip1"
;
//
// tsbAdd
//
this
.
tsbAdd
.
Image
=
global
::
Tools
.
Properties
.
Resources
.
新增
;
this
.
tsbAdd
.
ImageTransparentColor
=
System
.
Drawing
.
Color
.
Magenta
;
this
.
tsbAdd
.
Name
=
"tsbAdd"
;
this
.
tsbAdd
.
Size
=
new
System
.
Drawing
.
Size
(
52
,
22
);
this
.
tsbAdd
.
Text
=
"新增"
;
//
// tsbCopy
//
this
.
tsbCopy
.
Image
=
global
::
Tools
.
Properties
.
Resources
.
复制
;
this
.
tsbCopy
.
ImageTransparentColor
=
System
.
Drawing
.
Color
.
Magenta
;
this
.
tsbCopy
.
Name
=
"tsbCopy"
;
this
.
tsbCopy
.
Size
=
new
System
.
Drawing
.
Size
(
52
,
22
);
this
.
tsbCopy
.
Text
=
"复制"
;
//
// tsbDel
//
this
.
tsbDel
.
Image
=
((
System
.
Drawing
.
Image
)(
resources
.
GetObject
(
"tsbDel.Image"
)));
this
.
tsbDel
.
ImageTransparentColor
=
System
.
Drawing
.
Color
.
Magenta
;
this
.
tsbDel
.
Name
=
"tsbDel"
;
this
.
tsbDel
.
Size
=
new
System
.
Drawing
.
Size
(
52
,
22
);
this
.
tsbDel
.
Text
=
"删除"
;
//
// tsbSave
//
this
.
tsbSave
.
Image
=
global
::
Tools
.
Properties
.
Resources
.
保存
;
this
.
tsbSave
.
ImageTransparentColor
=
System
.
Drawing
.
Color
.
Magenta
;
this
.
tsbSave
.
Name
=
"tsbSave"
;
this
.
tsbSave
.
Size
=
new
System
.
Drawing
.
Size
(
52
,
22
);
this
.
tsbSave
.
Text
=
"保存"
;
//
// tsbDbSetting
//
this
.
tsbDbSetting
.
Image
=
global
::
Tools
.
Properties
.
Resources
.
数据库
;
this
.
tsbDbSetting
.
ImageTransparentColor
=
System
.
Drawing
.
Color
.
Magenta
;
this
.
tsbDbSetting
.
Name
=
"tsbDbSetting"
;
this
.
tsbDbSetting
.
Size
=
new
System
.
Drawing
.
Size
(
64
,
22
);
this
.
tsbDbSetting
.
Text
=
"数据库"
;
//
// tslDbLinkString
//
this
.
tslDbLinkString
.
AutoSize
=
false
;
...
...
@@ -302,18 +264,24 @@
this
.
tsmiCopy
,
this
.
tsmiDel
});
this
.
cmsDetail
.
Name
=
"cmsDetail"
;
this
.
cmsDetail
.
Size
=
new
System
.
Drawing
.
Size
(
1
81
,
92
);
this
.
cmsDetail
.
Size
=
new
System
.
Drawing
.
Size
(
1
01
,
70
);
//
// tsmiAdd
//
this
.
tsmiAdd
.
Name
=
"tsmiAdd"
;
this
.
tsmiAdd
.
Size
=
new
System
.
Drawing
.
Size
(
1
8
0
,
22
);
this
.
tsmiAdd
.
Size
=
new
System
.
Drawing
.
Size
(
1
0
0
,
22
);
this
.
tsmiAdd
.
Text
=
"増行"
;
//
// tsmiCopy
//
this
.
tsmiCopy
.
Name
=
"tsmiCopy"
;
this
.
tsmiCopy
.
Size
=
new
System
.
Drawing
.
Size
(
100
,
22
);
this
.
tsmiCopy
.
Text
=
"复制"
;
//
// tsmiDel
//
this
.
tsmiDel
.
Name
=
"tsmiDel"
;
this
.
tsmiDel
.
Size
=
new
System
.
Drawing
.
Size
(
1
8
0
,
22
);
this
.
tsmiDel
.
Size
=
new
System
.
Drawing
.
Size
(
1
0
0
,
22
);
this
.
tsmiDel
.
Text
=
"删行"
;
//
// tsFuncInfo
...
...
@@ -586,11 +554,53 @@
this
.
tbPrevID
.
Size
=
new
System
.
Drawing
.
Size
(
97
,
21
);
this
.
tbPrevID
.
TabIndex
=
28
;
//
// ts
miCopy
// ts
bAdd
//
this
.
tsmiCopy
.
Name
=
"tsmiCopy"
;
this
.
tsmiCopy
.
Size
=
new
System
.
Drawing
.
Size
(
180
,
22
);
this
.
tsmiCopy
.
Text
=
"复制"
;
this
.
tsbAdd
.
Image
=
global
::
Tools
.
Properties
.
Resources
.
新增
;
this
.
tsbAdd
.
ImageTransparentColor
=
System
.
Drawing
.
Color
.
Magenta
;
this
.
tsbAdd
.
Name
=
"tsbAdd"
;
this
.
tsbAdd
.
Size
=
new
System
.
Drawing
.
Size
(
52
,
22
);
this
.
tsbAdd
.
Text
=
"新增"
;
//
// tsbCopy
//
this
.
tsbCopy
.
Image
=
global
::
Tools
.
Properties
.
Resources
.
复制
;
this
.
tsbCopy
.
ImageTransparentColor
=
System
.
Drawing
.
Color
.
Magenta
;
this
.
tsbCopy
.
Name
=
"tsbCopy"
;
this
.
tsbCopy
.
Size
=
new
System
.
Drawing
.
Size
(
52
,
22
);
this
.
tsbCopy
.
Text
=
"复制"
;
//
// tsbDel
//
this
.
tsbDel
.
Image
=
global
::
Tools
.
Properties
.
Resources
.
删除
;
this
.
tsbDel
.
ImageTransparentColor
=
System
.
Drawing
.
Color
.
Magenta
;
this
.
tsbDel
.
Name
=
"tsbDel"
;
this
.
tsbDel
.
Size
=
new
System
.
Drawing
.
Size
(
52
,
22
);
this
.
tsbDel
.
Text
=
"删除"
;
//
// tsbSave
//
this
.
tsbSave
.
Image
=
global
::
Tools
.
Properties
.
Resources
.
保存
;
this
.
tsbSave
.
ImageTransparentColor
=
System
.
Drawing
.
Color
.
Magenta
;
this
.
tsbSave
.
Name
=
"tsbSave"
;
this
.
tsbSave
.
Size
=
new
System
.
Drawing
.
Size
(
52
,
22
);
this
.
tsbSave
.
Text
=
"保存"
;
//
// tsbGenSQL
//
this
.
tsbGenSQL
.
Image
=
global
::
Tools
.
Properties
.
Resources
.
sql
;
this
.
tsbGenSQL
.
ImageTransparentColor
=
System
.
Drawing
.
Color
.
Magenta
;
this
.
tsbGenSQL
.
Name
=
"tsbGenSQL"
;
this
.
tsbGenSQL
.
Size
=
new
System
.
Drawing
.
Size
(
99
,
22
);
this
.
tsbGenSQL
.
Text
=
"生成SQL脚本"
;
//
// tsbDbSetting
//
this
.
tsbDbSetting
.
Image
=
global
::
Tools
.
Properties
.
Resources
.
数据库
;
this
.
tsbDbSetting
.
ImageTransparentColor
=
System
.
Drawing
.
Color
.
Magenta
;
this
.
tsbDbSetting
.
Name
=
"tsbDbSetting"
;
this
.
tsbDbSetting
.
Size
=
new
System
.
Drawing
.
Size
(
64
,
22
);
this
.
tsbDbSetting
.
Text
=
"数据库"
;
//
// wModuleManager
//
...
...
@@ -673,5 +683,6 @@
private
System
.
Windows
.
Forms
.
ToolStripMenuItem
tsmiAdd
;
private
System
.
Windows
.
Forms
.
ToolStripMenuItem
tsmiDel
;
private
System
.
Windows
.
Forms
.
ToolStripMenuItem
tsmiCopy
;
private
System
.
Windows
.
Forms
.
ToolStripButton
tsbGenSQL
;
}
}
\ No newline at end of file
Tools/UI/wModuleManager.cs
View file @
2f02f6f2
...
...
@@ -56,6 +56,7 @@ namespace Tools.UI
this
.
tsbCopy
.
Click
+=
TsbCopy_Click
;
this
.
tsbDel
.
Click
+=
TsbDel_Click
;
this
.
tsbSave
.
Click
+=
TsbSave_Click
;
this
.
tsbGenSQL
.
Click
+=
TsbGenSQL_Click
;
this
.
tsbDbSetting
.
Click
+=
TsbDbSetting_Click
;
//上下文菜单事件
this
.
tsmiAdd
.
Click
+=
TsmiAdd_Click
;
...
...
@@ -129,6 +130,63 @@ namespace Tools.UI
{
this
.
Save
();
}
private
void
TsbGenSQL_Click
(
object
sender
,
EventArgs
e
)
{
//模块表
DataRow
drMaster
=
this
.
GetCurrentNodeRow
();
var
colist
=
this
.
GetTableColumns
(
this
.
_dtModel
);
var
model
=
$@"
INSERT INTO
{
this
.
_dtModel
.
TableName
}
{
this
.
GenColumns
(
colist
)}
VALUES
{
this
.
GenValues
(
drMaster
,
colist
)}
"
;
//功能表
var
funcColist
=
this
.
GetTableColumns
(
this
.
_dtDetail
);
var
values
=
this
.
_dtDetail
.
DefaultView
.
Cast
<
DataRowView
>().
Select
(
r
=>
this
.
GenValues
(
r
.
Row
,
funcColist
));
var
detail
=
$@"
INSERT INTO
{
this
.
_dtDetail
.
TableName
}
{
this
.
GenColumns
(
funcColist
)}
VALUES
{
string
.
Join
(
",\r\n"
,
values
)}
"
;
var
result
=
$@"
IF NOT EXISTS (SELECT 1 FROM SysBusinessModel WHERE Name = '
{
this
.
tbName
.
Text
}
')
BEGIN
{
model
}
DECLARE @ModelID INT
SET @ModelID=SCOPE_IDENTITY();
{
detail
}
END"
;
Utils
.
Tip
(
result
,
800
,
600
);
}
private
string
GenColumns
(
List
<
string
>
colist
)
{
return
$"(
{
string
.
Join
(
", "
,
colist
)}
)"
;
}
private
string
GenValues
(
DataRow
dr
,
List
<
string
>
colist
)
{
var
valist
=
colist
.
Select
(
col
=>
col
.
ToLower
().
Equals
(
"modelid"
)
?
"@ModelID"
:
$"'
{
dr
[
col
].
ToString
()}
'"
);
return
$"(
{
string
.
Join
(
", "
,
valist
)}
)"
;
}
private
List
<
string
>
GetTableColumns
(
DataTable
dt
)
{
var
result
=
new
List
<
string
>();
dt
.
Columns
.
Cast
<
DataColumn
>().
ToList
().
ForEach
(
c
=>
{
if
(!
c
.
AutoIncrement
)
{
result
.
Add
(
c
.
ColumnName
);
}
});
return
result
;
}
#
endregion
#
region
上下文菜单事件
...
...
Tools/UI/wModuleManager.resx
View file @
2f02f6f2
...
...
@@ -120,22 +120,6 @@
<metadata
name=
"toolStrip1.TrayLocation"
type=
"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
>
<value>
17, 17
</value>
</metadata>
<assembly
alias=
"System.Drawing"
name=
"System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
/>
<data
name=
"tsbDel.Image"
type=
"System.Drawing.Bitmap, System.Drawing"
mimetype=
"application/x-microsoft.net.object.bytearray.base64"
>
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
TgDQASA1MVpwzwAAAABJRU5ErkJggg==
</value>
</data>
<metadata
name=
"imgList5.TrayLocation"
type=
"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
>
<value>
634, 18
</value>
</metadata>
...
...
@@ -144,7 +128,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADo
CAAAAk1TRnQBSQFMAgEBAgEAA
UABAAFA
AQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CAAAAk1TRnQBSQFMAgEBAgEAA
XABAAFw
AQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
...
...
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