mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-20 17:57:54 +00:00
fix:create args bug
This commit is contained in:
+3
-1
@@ -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("字典标签或者字典键值已经存在!")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user