Skip to content

Commit 2c3f31e

Browse files
authored
fixbug: 修复代码生成器无法自动导入 time 包问题 (flipped-aurora#1368)
原本 for 循环下 if 判断只有 HasTimer 判断,加了 break 可以提前跳出循环,但另外新增了 NeedValid 和 NeedSort 判断后,直接跳出循环会导致无法正常设置 HasTimer ,NeedValid 和 NeedSort
1 parent 152f2c4 commit 2c3f31e

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

server/service/system/sys_auto_code.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,12 @@ func (autoCodeService *AutoCodeService) PreviewTemp(autoCode system.AutoCodeStru
134134
for i := range autoCode.Fields {
135135
if autoCode.Fields[i].FieldType == "time.Time" {
136136
autoCode.HasTimer = true
137-
break
138137
}
139138
if autoCode.Fields[i].Require {
140139
autoCode.NeedValid = true
141-
break
142140
}
143141
if autoCode.Fields[i].Sort {
144142
autoCode.NeedSort = true
145-
break
146143
}
147144
}
148145
dataList, _, needMkdir, err := autoCodeService.getNeedList(&autoCode)
@@ -227,15 +224,12 @@ func (autoCodeService *AutoCodeService) CreateTemp(autoCode system.AutoCodeStruc
227224
for i := range autoCode.Fields {
228225
if autoCode.Fields[i].FieldType == "time.Time" {
229226
autoCode.HasTimer = true
230-
break
231227
}
232228
if autoCode.Fields[i].Require {
233229
autoCode.NeedValid = true
234-
break
235230
}
236231
if autoCode.Fields[i].Sort {
237232
autoCode.NeedSort = true
238-
break
239233
}
240234
}
241235
// 增加判断: 重复创建struct

0 commit comments

Comments
 (0)