get_task_nature.go 501 字节
package query

import (
	"fmt"

	"github.com/astaxie/beego/validation"
)

type GetTaskNatureQuery struct {
	// 任务性质ID
	TaskNatureId int `json:"taskNatureId" valid:"Required"`
}

func (getTaskNatureQuery *GetTaskNatureQuery) ValidateQuery() error {
	valid := validation.Validation{}
	b, err := valid.Valid(getTaskNatureQuery)
	if err != nil {
		return err
	}
	if !b {
		for _, validErr := range valid.Errors {
			return fmt.Errorf("%s  %s", validErr.Key, validErr.Message)
		}
	}
	return nil
}