package models type EventPushRule struct { Id string `gorm:"primary_key;column:id" json:"id"` TopicType string `gorm:"column:topic_type" json:"topic_type"`//参数主题,目前分为五类(摄像机、底库、任务、人员、报警等级) TopicArg string `gorm:"column:topic_arg" json:"topic_arg"`//主题对应的具体参数 Operator string `gorm:"column:operator" json:"operator"` OperatorType string `gorm:"column:operator_type" json:"operator_type"` RuleValue string `gorm:"column:rule_value" json:"rule_value"` EventPushId string `gorm:"column:event_push_id" json:"event_push_id"` } func (EventPushRule) TableName() string { return "event_push_rule" } func (epr *EventPushRule) FindByEventPushId(eventPushId string) (list []EventPushRule,err error) { if err := db.Table("event_push_rule").Where("event_push_id=?",eventPushId).Scan(&list).Error;err !=nil { return nil,err } return list,nil }