mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-10-16 18:30:35 +00:00
added BatchDelete action
This commit is contained in:
@@ -105,3 +105,11 @@ func (e *SysConfig) Delete() (success bool, err error) {
|
||||
success = true
|
||||
return
|
||||
}
|
||||
|
||||
func (e *SysConfig) BatchDelete(id []int) (Result bool, err error) {
|
||||
if err = orm.Eloquent.Table(e.TableName()).Where("config_id in (?)", id).Delete(&SysConfig{}).Error; err != nil {
|
||||
return
|
||||
}
|
||||
Result = true
|
||||
return
|
||||
}
|
||||
|
||||
+1
-1
@@ -193,7 +193,7 @@ func (e *Dept) Update(id int) (update Dept, err error) {
|
||||
}
|
||||
|
||||
func (e *Dept) Delete(id int) (success bool, err error) {
|
||||
if err = orm.Eloquent.Table(e.TableName()).Where("dept_id = ?", e.DeptId).Delete(&Dept{}).Error; err != nil {
|
||||
if err = orm.Eloquent.Table(e.TableName()).Where("dept_id = ?", id).Delete(&Dept{}).Error; err != nil {
|
||||
success = false
|
||||
return
|
||||
}
|
||||
|
||||
@@ -131,3 +131,12 @@ func (e *DictData) Delete(id int) (success bool, err error) {
|
||||
success = true
|
||||
return
|
||||
}
|
||||
|
||||
func (e *DictData) BatchDelete(id []int) (Result bool, err error) {
|
||||
if err = orm.Eloquent.Table(e.TableName()).Where("dict_code in (?)", id).Delete(&DictData{}).Error; err != nil {
|
||||
return
|
||||
}
|
||||
Result = true
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -119,3 +119,11 @@ func (e *DictType) Delete(id int) (success bool, err error) {
|
||||
success = true
|
||||
return
|
||||
}
|
||||
|
||||
func (e *DictType) BatchDelete(id []int) (Result bool, err error) {
|
||||
if err = orm.Eloquent.Table(e.TableName()).Where("dict_id in (?)", id).Delete(&DictType{}).Error; err != nil {
|
||||
return
|
||||
}
|
||||
Result = true
|
||||
return
|
||||
}
|
||||
|
||||
@@ -129,3 +129,11 @@ func (e *Post) Delete(id int) (success bool, err error) {
|
||||
success = true
|
||||
return
|
||||
}
|
||||
|
||||
func (e *Post) BatchDelete(id []int) (Result bool, err error) {
|
||||
if err = orm.Eloquent.Table(e.TableName()).Where("post_id in (?)", id).Delete(&Post{}).Error; err != nil {
|
||||
return
|
||||
}
|
||||
Result = true
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user