package command import "github.com/beego/beego/v2/core/validation" // UserRoleDeleteCommand 角色中移除用户 type UserRoleDeleteCommand struct { CompanyId int64 `cname:"公司ID" json:"companyId"` RoleId int64 `cname:"角色ID" json:"roleId,string" valid:"Required"` UserId int64 `cname:"用户ID" json:"userId,string" valid:"Required"` } func (in *UserRoleDeleteCommand) Valid(validation *validation.Validation) { if in.CompanyId == 0 { validation.SetError("companyId", "公司ID无效") return } }