使用action代替api单个操作
改写job
This commit is contained in:
1 parent
78417c2d33
commit
562e61cf4f
15 files changed
+332
-6
No files matched your search
+24
-1
@@ -1,6 +1,7 @@
|
||||
package tools
|
||||
|
||||
import (
|
||||
"github.com/google/uuid"
|
||||
"go-admin/tools/config"
|
||||
|
||||
"github.com/matchstalk/go-admin-core/search"
|
||||
@@ -8,8 +9,30 @@ import (
|
||||
)
|
||||
|
||||
type GeneralDelDto struct {
|
||||
Id string `uri:"id" json:"id" validate:"required"`
|
||||
Id string `uri:"id" json:"id" validate:"required"`
|
||||
Ids []string `json:"ids"`
|
||||
}
|
||||
|
||||
func (g GeneralDelDto) GetIds() []string {
|
||||
ids := make([]string, 0)
|
||||
if len(g.Ids) > 0 {
|
||||
for _, id := range g.Ids {
|
||||
if len(id) > 0 {
|
||||
ids = append(ids, id)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if len(g.Id) > 0 {
|
||||
ids = append(ids, g.Id)
|
||||
}
|
||||
}
|
||||
if len(ids) <= 0 {
|
||||
//方式全部删除
|
||||
ids = append(ids, uuid.New().String())
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
type GeneralGetDto struct {
|
||||
Id string `uri:"id" json:"id" validate:"required"`
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package model
|
||||
|
||||
import "gorm.io/gorm/schema"
|
||||
|
||||
type ActiveRecord interface {
|
||||
schema.Tabler
|
||||
Generate() ActiveRecord
|
||||
GetId() interface{}
|
||||
GenerateList() interface{}
|
||||
}
|
||||
Reference in new issue
Block a user