package command import "github.com/beego/beego/v2/core/validation" type DeleteRoleCommand struct { CompanyId int64 `cname:"公司ID" json:"companyId"` Id int64 `cname:"角色ID" json:"id,string" valid:"Required"` } func (in *DeleteRoleCommand) Valid(validation *validation.Validation) { if in.CompanyId == 0 { validation.SetError("companyId", "公司ID无效") return } }