package command import "github.com/beego/beego/v2/core/validation" type QueryRuleCommand struct { CompanyId int64 `cname:"公司ID" json:"companyId"` NameOrRemark string `cname:"规则名称或备注" json:"nameOrRemark"` Type int `cname:"评估方式(0评级、1评分)" json:"type"` CreatorId int64 `cname:"创建人ID" json:"creatorId,string"` PageNumber int64 `cname:"分页页码" json:"pageNumber" valid:"Required"` PageSize int64 `cname:"分页数量" json:"pageSize" valid:"Required"` } type QueryCreatorCommand struct { CompanyId int64 `cname:"公司ID" json:"companyId"` } func (in *QueryRuleCommand) Valid(validation *validation.Validation) { if in.CompanyId == 0 { validation.SetError("companyId", "公司ID无效") return } } func (in *QueryCreatorCommand) Valid(validation *validation.Validation) { if in.CompanyId == 0 { validation.SetError("companyId", "公司ID无效") return } }