update_task_nature.go 598 字节
package command

import (
	"fmt"

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

type UpdateTaskNatureCommand struct {
	// 任务性质ID
	TaskNatureId int `json:"taskNatureId,omitempty"`
	// 任务性质名称
	TaskNatureName string `json:"taskNatureName,omitempty"`
}

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