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