package command import ( "fmt" "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" "github.com/beego/beego/v2/core/validation" ) type RemoveMenuCommand struct { //操作人 Operator domain.Operator `json:"-"` // 菜单编号 MenuId int64 `json:"menuId" valid:"Required"` } func (removeMenuCommand *RemoveMenuCommand) Valid(validation *validation.Validation) { } func (removeMenuCommand *RemoveMenuCommand) ValidateCommand() error { valid := validation.Validation{} b, err := valid.Valid(removeMenuCommand) if err != nil { return err } if !b { for _, validErr := range valid.Errors { return fmt.Errorf("%s %s", validErr.Key, validErr.Message) } } return nil }