审查视图

pkg/application/evaluation_rule/command/rule_query.go 953 字节
1 2 3 4 5
package command

import "github.com/beego/beego/v2/core/validation"

type QueryRuleCommand struct {
郑周 authored
6 7
	CompanyId    int64  `cname:"公司ID" json:"companyId"`
	NameOrRemark string `cname:"规则名称或备注" json:"nameOrRemark"`
郑周 authored
8 9
	Type         int    `cname:"评估方式(0评级、1评分)" json:"type"`
	CreatorId    int64  `cname:"创建人ID" json:"creatorId,string"`
郑周 authored
10 11
	PageNumber   int64  `cname:"分页页码" json:"pageNumber" valid:"Required"`
	PageSize     int64  `cname:"分页数量" json:"pageSize" valid:"Required"`
12 13
}
郑周 authored
14 15 16 17
type QueryCreatorCommand struct {
	CompanyId int64 `cname:"公司ID" json:"companyId"`
}
18 19 20 21 22 23
func (in *QueryRuleCommand) Valid(validation *validation.Validation) {
	if in.CompanyId == 0 {
		validation.SetError("companyId", "公司ID无效")
		return
	}
}
郑周 authored
24 25 26 27 28 29 30

func (in *QueryCreatorCommand) Valid(validation *validation.Validation) {
	if in.CompanyId == 0 {
		validation.SetError("companyId", "公司ID无效")
		return
	}
}