template_query.go 1.0 KB
package command

import (
	"github.com/beego/beego/v2/core/validation"
	"time"
)

type QueryTemplateCommand struct {
	CompanyId  int64      `cname:"公司ID" json:"companyId"`
	Name       string     `cname:"模板名称" json:"name"`
	State      int        `cname:"模板状态" json:"state"`
	CreatedAt  *time.Time `cname:"创建时间" json:"createdAt"`
	PageNumber int        `cname:"分页页码" json:"pageNumber" valid:"Required"`
	PageSize   int        `cname:"分页数量" json:"pageSize" valid:"Required"`
}

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

//// AllEnableTemplateCommand 查询所有已启用的模板
//type AllEnableTemplateCommand struct {
//	CompanyId int64 `cname:"公司ID" json:"companyId"`
//}
//
//func (in *AllEnableTemplateCommand) Valid(validation *validation.Validation) {
//	if in.CompanyId == 0 {
//		validation.SetError("companyId", "公司ID无效")
//		return
//	}
//}