fix:create args bug
This commit is contained in:
1 parent
58c7b43759
commit
3063386ec6
1 file changed
+3
-1
+3
-1
@@ -34,7 +34,9 @@ func (e *DictData) Create() (DictData, error) {
|
|||||||
var doc DictData
|
var doc DictData
|
||||||
|
|
||||||
var i int64
|
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 {
|
if i > 0 {
|
||||||
return doc, errors.New("字典标签或者字典键值已经存在!")
|
return doc, errors.New("字典标签或者字典键值已经存在!")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user