分类名重复不允许创建

This commit is contained in:
苏尹岚
2021-02-18 09:57:47 +08:00
parent a4fae9be65
commit 0ca51ca7fc
2 changed files with 20 additions and 1 deletions

View File

@@ -143,7 +143,11 @@ func AddCategory(ctx *jxcontext.Context, cat *model.SkuCategory, userName string
return nil, errors.New("Level3的分类其父分类必须为Level2分类")
}
}
if catsByName, err := dao.GetCategoriesByName(db, cat.Name); err == nil && len(catsByName) > 0 {
return nil, fmt.Errorf("已有分类名:[%v],分类名不允许重复!", cat.Name)
} else if err != nil {
return nil, err
}
dao.WrapAddIDCULDEntity(cat, userName)
// cat.JdSyncStatus = model.SyncFlagNewMask
// cat.JdID = 0