fix: 自动化代码需检测简称,简称不可以重复。
This commit is contained in:
@@ -64,8 +64,8 @@ func (s *autoCodeTemplate) Create(ctx context.Context, info request.AutoCode) er
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// 增加判断: 重复创建struct
|
||||
if AutocodeHistory.Repeat(info.BusinessDB, info.StructName, info.Package) {
|
||||
// 增加判断: 重复创建struct 或者重复的简称
|
||||
if AutocodeHistory.Repeat(info.BusinessDB, info.StructName, info.Abbreviation, info.Package) {
|
||||
return errors.New("已经创建过此数据结构,请勿重复创建!")
|
||||
}
|
||||
|
||||
@@ -190,6 +190,11 @@ func (s *autoCodeTemplate) Preview(ctx context.Context, info request.AutoCode) (
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "查询包失败!")
|
||||
}
|
||||
// 增加判断: 重复创建struct 或者重复的简称
|
||||
if AutocodeHistory.Repeat(info.BusinessDB, info.StructName, info.Abbreviation, info.Package) {
|
||||
return nil, errors.New("已经创建过此数据结构或重复简称,请勿重复创建!")
|
||||
}
|
||||
|
||||
codes := make(map[string]strings.Builder)
|
||||
preview := make(map[string]string)
|
||||
codes, _, _, err = s.generate(ctx, info, entity)
|
||||
|
Reference in New Issue
Block a user