Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VIZ.Package
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘龙飞
VIZ.Package
Commits
a6d01dbb
Commit
a6d01dbb
authored
Feb 16, 2023
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据库调整
parent
9fb027ea
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
59 deletions
+50
-59
VIZ.Package.Service/DB/ControlObject/ControlObjectService.cs
+34
-41
VIZ.Package.Storage/Entity/ControlObject/ControlFieldEntity.cs
+5
-0
VIZ.Package.Storage/Entity/ControlObject/ControlObjectEntity.cs
+5
-0
VIZ.Package.Storage/ProjectDbContext.cs
+6
-18
No files found.
VIZ.Package.Service/DB/ControlObject/ControlObjectService.cs
View file @
a6d01dbb
...
@@ -23,14 +23,13 @@ namespace VIZ.Package.Service
...
@@ -23,14 +23,13 @@ namespace VIZ.Package.Service
{
{
Guid
id
=
this
.
GetTemplateIdOrPageId
(
pageBase
);
Guid
id
=
this
.
GetTemplateIdOrPageId
(
pageBase
);
ILiteCollection
<
ControlFieldEntity
>
collection
=
ApplicationDomainEx
.
ProjectDbContext
.
GetControlFiled
(
id
);
ApplicationDomainEx
.
ProjectDbContext
.
ControlField
.
DeleteMany
(
p
=>
p
.
PageID
==
id
);
collection
.
DeleteAll
();
List
<
ControlFieldEntity
>
list
=
new
List
<
ControlFieldEntity
>();
List
<
ControlFieldEntity
>
list
=
new
List
<
ControlFieldEntity
>();
foreach
(
ControlFieldNodeModel
field
in
fields
)
foreach
(
ControlFieldNodeModel
field
in
fields
)
{
{
ControlFieldEntity
entity
=
new
ControlFieldEntity
();
ControlFieldEntity
entity
=
new
ControlFieldEntity
();
entity
.
PageID
=
id
;
entity
.
FieldIdentifier
=
field
.
FieldIdentifier
;
entity
.
FieldIdentifier
=
field
.
FieldIdentifier
;
entity
.
Value
=
field
.
Value
;
entity
.
Value
=
field
.
Value
;
entity
.
Type
=
field
.
Type
;
entity
.
Type
=
field
.
Type
;
...
@@ -38,35 +37,24 @@ namespace VIZ.Package.Service
...
@@ -38,35 +37,24 @@ namespace VIZ.Package.Service
list
.
Add
(
entity
);
list
.
Add
(
entity
);
}
}
collection
.
Insert
(
list
);
ApplicationDomainEx
.
ProjectDbContext
.
ControlField
.
Insert
(
list
);
}
/// <summary>
/// 保存控制字段
/// </summary>
/// <param name="pageBase">页或模板</param>
/// <param name="fields">控制字段</param>
public
void
SaveControlFields
(
PageModelBase
pageBase
,
IList
<
ControlFieldEntity
>
fields
)
{
Guid
id
=
this
.
GetTemplateIdOrPageId
(
pageBase
);
ILiteCollection
<
ControlFieldEntity
>
collection
=
ApplicationDomainEx
.
ProjectDbContext
.
GetControlFiled
(
id
);
collection
.
DeleteAll
();
collection
.
Insert
(
fields
);
}
}
/// <summary>
/// <summary>
/// 拷贝控制字段
/// 拷贝控制字段
/// </summary>
/// </summary>
/// <param name="srcID">源ID</param>
/// <param name="srcID">源ID</param>
/// <param name="d
i
stID">目标ID</param>
/// <param name="dstID">目标ID</param>
public
void
CopyControlFields
(
Guid
srcID
,
Guid
d
i
stID
)
public
void
CopyControlFields
(
Guid
srcID
,
Guid
dstID
)
{
{
ILiteCollection
<
ControlFieldEntity
>
srcCollection
=
ApplicationDomainEx
.
ProjectDbContext
.
GetControlFiled
(
srcID
);
var
src
=
ApplicationDomainEx
.
ProjectDbContext
.
ControlField
.
Find
(
p
=>
p
.
PageID
==
srcID
).
ToList
();
ILiteCollection
<
ControlFieldEntity
>
dstCollection
=
ApplicationDomainEx
.
ProjectDbContext
.
GetControlFiled
(
distID
);
ApplicationDomainEx
.
ProjectDbContext
.
ControlField
.
DeleteMany
(
p
=>
p
.
PageID
==
dstID
);
src
.
ForEach
(
p
=>
dstCollection
.
DeleteAll
();
{
dstCollection
.
Insert
(
srcCollection
.
FindAll
());
p
.
Id
=
0
;
p
.
PageID
=
dstID
;
});
ApplicationDomainEx
.
ProjectDbContext
.
ControlField
.
Insert
(
src
);
}
}
/// <summary>
/// <summary>
...
@@ -78,9 +66,9 @@ namespace VIZ.Package.Service
...
@@ -78,9 +66,9 @@ namespace VIZ.Package.Service
{
{
Guid
id
=
this
.
GetTemplateIdOrPageId
(
pageBase
);
Guid
id
=
this
.
GetTemplateIdOrPageId
(
pageBase
);
ILiteCollection
<
ControlFieldEntity
>
collection
=
ApplicationDomainEx
.
ProjectDbContext
.
GetControlFiled
(
id
);
var
result
=
ApplicationDomainEx
.
ProjectDbContext
.
ControlField
.
Find
(
p
=>
p
.
PageID
==
id
);
return
collection
.
FindAll
()
.
ToList
();
return
result
.
ToList
();
}
}
/// <summary>
/// <summary>
...
@@ -109,36 +97,41 @@ namespace VIZ.Package.Service
...
@@ -109,36 +97,41 @@ namespace VIZ.Package.Service
/// </summary>
/// </summary>
/// <param name="pageBase">页或模板</param>
/// <param name="pageBase">页或模板</param>
/// <param name="obj">控制对象</param>
/// <param name="obj">控制对象</param>
/// <remarks>
/// 目前每个页只保留主控制对象
/// </remarks>
public
void
SaveControlObject
(
PageModelBase
pageBase
,
ControlObjectModel
obj
)
public
void
SaveControlObject
(
PageModelBase
pageBase
,
ControlObjectModel
obj
)
{
{
Guid
id
=
this
.
GetTemplateIdOrPageId
(
pageBase
);
Guid
id
=
this
.
GetTemplateIdOrPageId
(
pageBase
);
ILiteCollection
<
ControlObjectEntity
>
collection
=
ApplicationDomainEx
.
ProjectDbContext
.
GetControlObject
(
id
);
ControlObjectEntity
entity
=
ApplicationDomainEx
.
ProjectDbContext
.
ControlObject
.
FindOne
(
p
=>
p
.
PageID
==
id
);
entity
=
entity
??
new
ControlObjectEntity
();
collection
.
DeleteAll
();
ControlObjectEntity
entity
=
new
ControlObjectEntity
()
;
entity
.
PageID
=
id
;
entity
.
TreeNodeName
=
obj
.
TreeNodeName
;
entity
.
TreeNodeName
=
obj
.
TreeNodeName
;
entity
.
TreeNodePath
=
obj
.
TreeNodePath
;
entity
.
TreeNodePath
=
obj
.
TreeNodePath
;
entity
.
Description
=
obj
.
Description
;
entity
.
Description
=
obj
.
Description
;
entity
.
UseAllDirectors
=
obj
.
UseAllDirectors
;
entity
.
UseAllDirectors
=
obj
.
UseAllDirectors
;
entity
.
FieldDetails
=
obj
.
FieldDetails
;
entity
.
FieldDetails
=
obj
.
FieldDetails
;
collection
.
In
sert
(
entity
);
ApplicationDomainEx
.
ProjectDbContext
.
ControlObject
.
Up
sert
(
entity
);
}
}
/// <summary>
/// <summary>
/// 拷贝控制对象
/// 拷贝控制对象
/// </summary>
/// </summary>
/// <param name="srcID">源ID</param>
/// <param name="srcID">源ID</param>
/// <param name="d
i
stID">目标ID</param>
/// <param name="dstID">目标ID</param>
public
void
CopyControlObjects
(
Guid
srcID
,
Guid
d
i
stID
)
public
void
CopyControlObjects
(
Guid
srcID
,
Guid
dstID
)
{
{
ILiteCollection
<
ControlObjectEntity
>
srcCollection
=
ApplicationDomainEx
.
ProjectDbContext
.
GetControlObject
(
srcID
);
var
src
=
ApplicationDomainEx
.
ProjectDbContext
.
ControlObject
.
Find
(
p
=>
p
.
PageID
==
srcID
).
ToList
();
ILiteCollection
<
ControlObjectEntity
>
dstCollection
=
ApplicationDomainEx
.
ProjectDbContext
.
GetControlObject
(
distID
);
src
.
ForEach
(
p
=>
{
dstCollection
.
DeleteAll
();
p
.
Id
=
0
;
dstCollection
.
Insert
(
srcCollection
.
FindAll
());
p
.
PageID
=
dstID
;
});
ApplicationDomainEx
.
ProjectDbContext
.
ControlObject
.
DeleteMany
(
p
=>
p
.
PageID
==
dstID
);
ApplicationDomainEx
.
ProjectDbContext
.
ControlObject
.
Insert
(
src
);
}
}
/// <summary>
/// <summary>
...
@@ -150,9 +143,9 @@ namespace VIZ.Package.Service
...
@@ -150,9 +143,9 @@ namespace VIZ.Package.Service
{
{
Guid
id
=
this
.
GetTemplateIdOrPageId
(
pageBase
);
Guid
id
=
this
.
GetTemplateIdOrPageId
(
pageBase
);
ILiteCollection
<
ControlObjectEntity
>
collection
=
ApplicationDomainEx
.
ProjectDbContext
.
GetControlObject
(
id
);
var
result
=
ApplicationDomainEx
.
ProjectDbContext
.
ControlObject
.
Find
(
p
=>
p
.
PageID
==
id
).
ToList
(
);
return
collection
.
FindAll
().
ToList
()
;
return
result
;
}
}
/// <summary>
/// <summary>
...
...
VIZ.Package.Storage/Entity/ControlObject/ControlFieldEntity.cs
View file @
a6d01dbb
...
@@ -19,6 +19,11 @@ namespace VIZ.Package.Storage
...
@@ -19,6 +19,11 @@ namespace VIZ.Package.Storage
public
int
Id
{
get
;
set
;
}
public
int
Id
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 所属模板ID或页ID
/// </summary>
public
Guid
PageID
{
get
;
set
;
}
/// <summary>
/// 字段名称
/// 字段名称
/// </summary>
/// </summary>
public
string
FieldIdentifier
{
get
;
set
;
}
public
string
FieldIdentifier
{
get
;
set
;
}
...
...
VIZ.Package.Storage/Entity/ControlObject/ControlObjectEntity.cs
View file @
a6d01dbb
...
@@ -19,6 +19,11 @@ namespace VIZ.Package.Storage
...
@@ -19,6 +19,11 @@ namespace VIZ.Package.Storage
public
int
Id
{
get
;
set
;
}
public
int
Id
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 所属模板ID或页ID
/// </summary>
public
Guid
PageID
{
get
;
set
;
}
/// <summary>
/// 所在场景节点名称
/// 所在场景节点名称
/// </summary>
/// </summary>
public
string
TreeNodeName
{
get
;
set
;
}
public
string
TreeNodeName
{
get
;
set
;
}
...
...
VIZ.Package.Storage/ProjectDbContext.cs
View file @
a6d01dbb
...
@@ -37,6 +37,8 @@ namespace VIZ.Package.Storage
...
@@ -37,6 +37,8 @@ namespace VIZ.Package.Storage
this
.
PageTemplate
=
this
.
Database
.
GetCollection
<
PageTemplateEntity
>();
this
.
PageTemplate
=
this
.
Database
.
GetCollection
<
PageTemplateEntity
>();
this
.
PageGroup
=
this
.
Database
.
GetCollection
<
PageGroupEntity
>();
this
.
PageGroup
=
this
.
Database
.
GetCollection
<
PageGroupEntity
>();
this
.
Page
=
this
.
Database
.
GetCollection
<
PageEntity
>();
this
.
Page
=
this
.
Database
.
GetCollection
<
PageEntity
>();
this
.
ControlField
=
this
.
Database
.
GetCollection
<
ControlFieldEntity
>();
this
.
ControlObject
=
this
.
Database
.
GetCollection
<
ControlObjectEntity
>();
}
}
/// <summary>
/// <summary>
...
@@ -60,28 +62,14 @@ namespace VIZ.Package.Storage
...
@@ -60,28 +62,14 @@ namespace VIZ.Package.Storage
public
ILiteCollection
<
PageEntity
>
Page
{
get
;
private
set
;
}
public
ILiteCollection
<
PageEntity
>
Page
{
get
;
private
set
;
}
/// <summary>
/// <summary>
///
根据ID获取控制字段, ID 为 TemplateID 或者 PageID
///
控制字段
/// </summary>
/// </summary>
/// <param name="id">TemplateID 或者 PageID</param>
public
ILiteCollection
<
ControlFieldEntity
>
ControlField
{
get
;
private
set
;
}
/// <returns>控制字段</returns>
public
ILiteCollection
<
ControlFieldEntity
>
GetControlFiled
(
Guid
id
)
{
string
name
=
$"PAGE_CONTROL_FIELD_
{
id
.
ToString
().
Replace
(
"-"
,
string
.
Empty
)}
"
;
return
this
.
Database
.
GetCollection
<
ControlFieldEntity
>(
name
);
}
/// <summary>
/// <summary>
///
根据ID获取控制对象列表, ID 为 TemplateID 或者 PageID
///
控制对象
/// </summary>
/// </summary>
/// <param name="id">TemplateID 或者 PageID</param>
public
ILiteCollection
<
ControlObjectEntity
>
ControlObject
{
get
;
private
set
;
}
/// <returns>控制对象</returns>
public
ILiteCollection
<
ControlObjectEntity
>
GetControlObject
(
Guid
id
)
{
string
name
=
$"PAGE_CONTROL_OBJECT_
{
id
.
ToString
().
Replace
(
"-"
,
string
.
Empty
)}
"
;
return
this
.
Database
.
GetCollection
<
ControlObjectEntity
>(
name
);
}
/// <summary>
/// <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