add free vertex process in create update delete api
This commit is contained in:
parent
410c08b132
commit
cd2451c985
|
|
@ -10,7 +10,7 @@
|
||||||
"uuid_to":"12311-116"
|
"uuid_to":"12311-116"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"free_vertex":[
|
"free_vertexs":[
|
||||||
"12311-111",
|
"12311-111",
|
||||||
"12311-112",
|
"12311-112",
|
||||||
"12311-115"
|
"12311-115"
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,11 @@
|
||||||
"uuid_to":"12311-116"
|
"uuid_to":"12311-116"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"free_vertexs":[
|
||||||
|
"12311-111",
|
||||||
|
"12311-112",
|
||||||
|
"12311-115"
|
||||||
|
],
|
||||||
"component_infos":[
|
"component_infos":[
|
||||||
{
|
{
|
||||||
"uuid":"12311-114",
|
"uuid":"12311-114",
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
"new_uuid_to":"12311-116"
|
"new_uuid_to":"12311-116"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"free_vertex":[
|
"free_vertexs":[
|
||||||
"12311-111",
|
"12311-111",
|
||||||
"12311-112",
|
"12311-112",
|
||||||
"12311-115"
|
"12311-115"
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,12 @@ func CircuitDiagramCreateHandler(c *gin.Context) {
|
||||||
diagram.StoreComponentMap(componentInfo.UUID, &componentMap)
|
diagram.StoreComponentMap(componentInfo.UUID, &componentMap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(request.FreeVertexs) > 0 {
|
||||||
|
for _, freeVertex := range request.FreeVertexs {
|
||||||
|
graph.FreeVertexs[freeVertex] = struct{}{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// commit transsction
|
// commit transsction
|
||||||
tx.Commit()
|
tx.Commit()
|
||||||
resp := network.BasicResponse{
|
resp := network.BasicResponse{
|
||||||
|
|
|
||||||
|
|
@ -190,6 +190,12 @@ func CircuitDiagramDeleteHandler(c *gin.Context) {
|
||||||
diagram.DeleteComponentMap(componentInfo.UUID)
|
diagram.DeleteComponentMap(componentInfo.UUID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(request.FreeVertexs) > 0 {
|
||||||
|
for _, freeVertex := range request.FreeVertexs {
|
||||||
|
delete(graph.FreeVertexs, freeVertex)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// commit transsction
|
// commit transsction
|
||||||
tx.Commit()
|
tx.Commit()
|
||||||
resp := network.BasicResponse{
|
resp := network.BasicResponse{
|
||||||
|
|
|
||||||
|
|
@ -147,6 +147,12 @@ func CircuitDiagramUpdateHandler(c *gin.Context) {
|
||||||
diagram.UpdateComponentMap(componentInfo.UUID, &componentMap)
|
diagram.UpdateComponentMap(componentInfo.UUID, &componentMap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(request.FreeVertexs) > 0 {
|
||||||
|
for _, freeVertex := range request.FreeVertexs {
|
||||||
|
graph.FreeVertexs[freeVertex] = struct{}{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// commit transsction
|
// commit transsction
|
||||||
tx.Commit()
|
tx.Commit()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ type ComponentCreateInfo struct {
|
||||||
// CircuitDiagramCreateRequest defines request params of circuit diagram create api
|
// CircuitDiagramCreateRequest defines request params of circuit diagram create api
|
||||||
type CircuitDiagramCreateRequest struct {
|
type CircuitDiagramCreateRequest struct {
|
||||||
PageID int64 `json:"page_id"`
|
PageID int64 `json:"page_id"`
|
||||||
|
FreeVertexs []string `json:"free_vertexs"`
|
||||||
TopologicLinks []TopologicCreateInfo `json:"topologics"`
|
TopologicLinks []TopologicCreateInfo `json:"topologics"`
|
||||||
ComponentInfos []ComponentCreateInfo `json:"component_infos"`
|
ComponentInfos []ComponentCreateInfo `json:"component_infos"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ type ComponentDelInfo struct {
|
||||||
// CircuitDiagramDeleteRequest defines request params of circuit diagram delete api
|
// CircuitDiagramDeleteRequest defines request params of circuit diagram delete api
|
||||||
type CircuitDiagramDeleteRequest struct {
|
type CircuitDiagramDeleteRequest struct {
|
||||||
PageID int64 `json:"page_id"`
|
PageID int64 `json:"page_id"`
|
||||||
|
FreeVertexs []string `json:"free_vertexs"`
|
||||||
TopologicLinks []TopologicDelInfo `json:"topologics"`
|
TopologicLinks []TopologicDelInfo `json:"topologics"`
|
||||||
ComponentInfos []ComponentDelInfo `json:"component_infos"`
|
ComponentInfos []ComponentDelInfo `json:"component_infos"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ type ComponentUpdateInfo struct {
|
||||||
// CircuitDiagramUpdateRequest defines request params of circuit diagram update api
|
// CircuitDiagramUpdateRequest defines request params of circuit diagram update api
|
||||||
type CircuitDiagramUpdateRequest struct {
|
type CircuitDiagramUpdateRequest struct {
|
||||||
PageID int64 `json:"page_id"`
|
PageID int64 `json:"page_id"`
|
||||||
|
FreeVertexs []string `json:"free_vertexs"`
|
||||||
TopologicLinks []TopologicChangeInfo `json:"topologics"`
|
TopologicLinks []TopologicChangeInfo `json:"topologics"`
|
||||||
ComponentInfos []ComponentUpdateInfo `json:"component_infos"`
|
ComponentInfos []ComponentUpdateInfo `json:"component_infos"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,5 +13,5 @@ var RecursiveSQL = `WITH RECURSIVE recursive_tree as (
|
||||||
)
|
)
|
||||||
SELECT * FROM recursive_tree;`
|
SELECT * FROM recursive_tree;`
|
||||||
|
|
||||||
// TODO 为 Topologic 表增加唯一所以
|
// TODO 为 Topologic 表增加唯一索引
|
||||||
// CREATE UNIQUE INDEX uuid_from_to_page_id_idx ON public."Topologic"(uuid_from,uuid_to,page_id);
|
// CREATE UNIQUE INDEX uuid_from_to_page_id_idx ON public."Topologic"(uuid_from,uuid_to,page_id);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue