Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zendata
提交
939fb58b
Z
zendata
项目概览
易企天创
/
zendata
10 个月 前同步成功
通知
17
Star
2
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zendata
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
939fb58b
编写于
12月 08, 2020
作者:
aaronchen2k2k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
close task#8569
上级
f982c222
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
36 addition
and
9 deletion
+36
-9
src/model/model.go
src/model/model.go
+2
-0
src/server/service/def.go
src/server/service/def.go
+7
-4
src/server/service/instances.go
src/server/service/instances.go
+7
-4
tmp/cache/.data.db
tmp/cache/.data.db
+0
-0
users/test/_test01.yaml
users/test/_test01.yaml
+9
-1
users/test/_test03.yaml
users/test/_test03.yaml
+11
-0
未找到文件。
src/model/model.go
浏览文件 @
939fb58b
...
...
@@ -22,6 +22,7 @@ type ZdDef struct {
FileName
string
`gorm:"column:fileName" json:"fileName" yaml:"-"`
ReferName
string
`gorm:"column:referName" json:"referName" yaml:"-"`
From
string
`gorm:"-" json:"from"`
Fields
[]
ZdField
`gorm:"-" json:"fields"`
}
...
...
@@ -177,6 +178,7 @@ type ZdInstances struct {
FileName
string
`gorm:"column:fileName" json:"fileName" yaml:"-"`
ReferName
string
`gorm:"column:referName" json:"referName" yaml:"-"`
From
string
`gorm:"-" json:"from"`
Instances
[]
ZdInstancesItem
`gorm:"ForeignKey:instancesID" json:"instances" yaml:"instances"`
}
...
...
src/server/service/def.go
浏览文件 @
939fb58b
...
...
@@ -209,18 +209,18 @@ func (s *DefService) SyncToDB(fi model.ResFile) (err error) {
s
.
referRepo
.
CreateDefault
(
rootField
.
ID
,
constant
.
ResTypeDef
)
for
i
,
field
:=
range
po
.
Fields
{
field
.
Ord
=
i
+
1
s
.
saveFieldToDB
(
&
field
,
fi
.
Path
,
rootField
.
ID
,
po
.
ID
)
s
.
saveFieldToDB
(
&
field
,
po
,
fi
.
Path
,
rootField
.
ID
,
po
.
ID
)
}
return
}
func
(
s
*
DefService
)
saveFieldToDB
(
field
*
model
.
ZdField
,
currPath
string
,
parentID
,
defID
uint
)
{
func
(
s
*
DefService
)
saveFieldToDB
(
field
*
model
.
ZdField
,
def
model
.
ZdDef
,
currPath
string
,
parentID
,
defID
uint
)
{
if
field
.
Froms
!=
nil
&&
len
(
field
.
Froms
)
>
0
{
for
idx
,
from
:=
range
field
.
Froms
{
if
from
.
Field
==
""
{
from
.
Field
=
"from"
+
strconv
.
Itoa
(
idx
+
1
)
}
s
.
saveFieldToDB
(
from
,
currPath
,
parentID
,
defID
)
s
.
saveFieldToDB
(
from
,
def
,
currPath
,
parentID
,
defID
)
}
return
...
...
@@ -229,6 +229,9 @@ func (s *DefService) saveFieldToDB(field *model.ZdField, currPath string, parent
// update field
field
.
DefID
=
defID
field
.
ParentID
=
parentID
if
field
.
From
==
""
&&
def
.
From
!=
""
{
field
.
From
=
def
.
From
}
if
field
.
Type
==
""
{
field
.
Type
=
constant
.
FieldTypeList
}
...
...
@@ -327,7 +330,7 @@ func (s *DefService) saveFieldToDB(field *model.ZdField, currPath string, parent
// deal with field's children
for
_
,
child
:=
range
field
.
Fields
{
s
.
saveFieldToDB
(
child
,
currPath
,
field
.
ID
,
defID
)
s
.
saveFieldToDB
(
child
,
def
,
currPath
,
field
.
ID
,
defID
)
}
}
...
...
src/server/service/instances.go
浏览文件 @
939fb58b
...
...
@@ -169,18 +169,18 @@ func (s *InstancesService) SyncToDB(fi model.ResFile) (err error) {
for
i
,
item
:=
range
po
.
Instances
{
item
.
Ord
=
i
+
1
s
.
saveItemToDB
(
&
item
,
fi
.
Path
,
0
,
po
.
ID
)
s
.
saveItemToDB
(
&
item
,
po
,
fi
.
Path
,
0
,
po
.
ID
)
}
return
}
func
(
s
*
InstancesService
)
saveItemToDB
(
item
*
model
.
ZdInstancesItem
,
currPath
string
,
parentID
,
instancesID
uint
)
{
func
(
s
*
InstancesService
)
saveItemToDB
(
item
*
model
.
ZdInstancesItem
,
instances
model
.
ZdInstances
,
currPath
string
,
parentID
,
instancesID
uint
)
{
if
item
.
Froms
!=
nil
&&
len
(
item
.
Froms
)
>
0
{
for
idx
,
from
:=
range
item
.
Froms
{
if
from
.
Field
==
""
{
from
.
Field
=
"from"
+
strconv
.
Itoa
(
idx
+
1
)
}
s
.
saveItemToDB
(
from
,
currPath
,
parentID
,
instancesID
)
s
.
saveItemToDB
(
from
,
instances
,
currPath
,
parentID
,
instancesID
)
}
return
...
...
@@ -193,6 +193,9 @@ func (s *InstancesService) saveItemToDB(item *model.ZdInstancesItem, currPath st
item
.
InstancesID
=
instancesID
item
.
ParentID
=
parentID
if
item
.
From
==
""
&&
instances
.
From
!=
""
{
item
.
From
=
instances
.
From
}
if
item
.
Type
==
""
{
item
.
Type
=
constant
.
FieldTypeList
}
...
...
@@ -295,7 +298,7 @@ func (s *InstancesService) saveItemToDB(item *model.ZdInstancesItem, currPath st
// deal with field's children
for
i
,
child
:=
range
item
.
Fields
{
child
.
Ord
=
i
+
1
s
.
saveItemToDB
(
child
,
currPath
,
item
.
ID
,
instancesID
)
s
.
saveItemToDB
(
child
,
instances
,
currPath
,
item
.
ID
,
instancesID
)
}
}
...
...
tmp/cache/.data.db
浏览文件 @
939fb58b
无法预览此类型文件
users/test/_test01.yaml
浏览文件 @
939fb58b
...
...
@@ -2,16 +2,20 @@ title: 数据测试1
desc
:
数据测试1
fields
:
-
field
:
field_with_children
from
:
zentao.number.v1.yaml
fields
:
-
field
:
field_text
range
:
test/dir/users.txt:7
postfix
:
"
\t
"
from
:
zentao.number.v1.yaml
-
field
:
field_yaml
range
:
test/dir/content.yaml{7}
postfix
:
"
\t
"
from
:
zentao.number.v1.yaml
-
field
:
field_use_config
postfix
:
"
\t
"
config
:
test/dir/config.yaml
from
:
zentao.number.v1.yaml
-
field
:
field_use_ranges
postfix
:
"
\t
"
from
:
zentao.number.v1.yaml
...
...
@@ -31,17 +35,21 @@ fields:
prefix
:
"
\t
"
postfix
:
'
|'
loop
:
"
3"
from
:
zentao.number.v1.yaml
-
field
:
child2
range
:
A-Z
prefix
:
part2_
postfix
:
'
|'
from
:
zentao.number.v1.yaml
-
field
:
child_with_child
prefix
:
part3_
from
:
zentao.number.v1.yaml
fields
:
-
field
:
field_grandson
range
:
10-20
prefix
:
int_
-
field
:
from1
from
:
zentao.number.v1.yaml
-
field
:
refer1
postfix
:
'
-'
from
:
zentao.number.v1.yaml
use
:
small{2}
...
...
users/test/_test03.yaml
0 → 100644
浏览文件 @
939fb58b
title
:
数据测试1
desc
:
数据测试1
from
:
zentao.number.v1.yaml
# 全局From配置
fields
:
-
field
:
refer1
# 使用全局From配置
postfix
:
'
-'
use
:
small{2}
-
from
:
zentao.number.v1.yaml
use
:
large{3}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录