分类名重复不允许创建
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user