permission_update.go
1.1 KB
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"`
UserId int64 `cname:"用户ID"`
OptHrScore int `cname:"上级修改人资综评分数" json:"optHrScore" valid:"Required"`
OptEvalScore int `cname:"上级修改360°综评分数" json:"optEvalScore" valid:"Required"`
OptConfirmPerf int `cname:"是否需要员工确认绩效" json:"optConfirmPerf"`
CycleDeadLine *domain.CycleDeadline `cname:"周期评估各业务截止时间" json:"cycleDeadline"`
}
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
}
}