fix:create args bug

This commit is contained in:
zhangwenjian
2020-08-29 16:31:56 +08:00
parent 58c7b43759
commit 3063386ec6
+3 -1
View File
@@ -34,7 +34,9 @@ func (e *DictData) Create() (DictData, error) {
var doc DictData
var i int64
orm.Eloquent.Table(e.TableName()).Where("dict_label=? or (dict_label=? and dict_value = ?)", e.DictLabel, e.DictValue).Count(&i)
if err := orm.Eloquent.Table(e.TableName()).Where("dict_label=? or (dict_label=? and dict_value = ?)", e.DictLabel, e.DictLabel, e.DictValue).Count(&i).Error; err != nil {
return doc, err
}
if i > 0 {
return doc, errors.New("字典标签或者字典键值已经存在!")
}