Skip to content

Commit 9ba39f2

Browse files
author
piexlMax(奇淼
committed
fix: 新增字段在没有选择gvaModel的情况下,防止出现空指针
1 parent 4a70b38 commit 9ba39f2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

server/model/system/request/sys_auto_code.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,19 @@ func (r *AutoCode) Pretreatment() error {
186186
}
187187
}
188188
} // GvaModel
189+
{
190+
if r.IsAdd && r.PrimaryField == nil {
191+
r.PrimaryField = &AutoCodeField{
192+
FieldName: "",
193+
FieldType: "",
194+
FieldDesc: "",
195+
FieldJson: "",
196+
DataTypeLong: "",
197+
Comment: "",
198+
ColumnName: "",
199+
}
200+
}
201+
} // 新增字段模式下不关注主键
189202
if r.Package == "" {
190203
return errors.New("Package为空!")
191204
} // 增加判断:Package不为空

0 commit comments

Comments
 (0)