permission_update.go 838 字节
package command

import (
	"github.com/beego/beego/v2/core/validation"
	"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
)

type UpdatePermissionCommand struct {
	CompanyId    int64 `cname:"公司Id"`
	OptHrScore   int   `cname:"上级修改人资综评分数" json:"optHrScore" valid:"Required"`
	OptEvalScore int   `cname:"上级修改360°综评分数" json:"optEvalScore" valid:"Required"`
}

func (in *UpdatePermissionCommand) Valid(validation *validation.Validation) {
	switch in.OptHrScore {
	case domain.PermissionOff, domain.PermissionOn:
	default:
		validation.SetError("optHrScore", "修改人资综评分数参数错误")
		return
	}

	switch in.OptEvalScore {
	case domain.PermissionOff, domain.PermissionOn:
	default:
		validation.SetError("optEvalScore", "修改360°综评分数参数错误")
		return
	}
}