package data_manage import ( "github.com/beego/beego/v2/client/orm" "time" ) // BusinessSysInteractionLog 商家系统交互记录表 type BusinessSysInteractionLog struct { ID uint32 `orm:"column(id);pk" gorm:"primaryKey;column:id;type:int(10) unsigned;not null" json:"-"` InteractionKey string `gorm:"unique;column:interaction_key;type:varchar(128);not null;default:''" json:"interactionKey"` // 记录Key InteractionVal string `gorm:"column:interaction_val;type:text;default:null" json:"interactionVal"` // 记录值 Remark string `gorm:"column:remark;type:varchar(128);not null;default:''" json:"remark"` // 备注 ModifyTime time.Time `gorm:"column:modify_time;type:datetime;default:null" json:"modifyTime"` // 修改日期 CreateTime time.Time `gorm:"column:create_time;type:datetime;default:null" json:"createTime"` // 创建时间 } // TableName get sql table name.获取数据库表名 func (m *BusinessSysInteractionLog) TableName() string { return "business_sys_interaction_log" } // BusinessSysInteractionLogColumns get sql column name.获取数据库列名 var BusinessSysInteractionLogColumns = struct { ID string InteractionKey string InteractionVal string Remark string ModifyTime string CreateTime string }{ ID: "id", InteractionKey: "interaction_key", InteractionVal: "interaction_val", Remark: "remark", ModifyTime: "modify_time", CreateTime: "create_time", } // Create 添加数据 func (m *BusinessSysInteractionLog) Create() (err error) { o := orm.NewOrm() id, err := o.Insert(m) if err != nil { return } m.ID = uint32(id) return } // Update 更新数据 func (m *BusinessSysInteractionLog) Update(cols []string) (err error) { o := orm.NewOrm() _, err = o.Update(m, cols...) return } var BinlogFileNameKey = "binlog_filename" // binlog文件名 var BinlogPositionKey = "binlog_binlog_position" // binlog位置 var CrmIndexLastUpdateTime = "crm_index_update_time" // crm数据 // GetBusinessSysInteractionLogByKey 根据记录key获取数据 func GetBusinessSysInteractionLogByKey(key string) (item *BusinessSysInteractionLog, err error) { o := orm.NewOrm() sql := `SELECT * FROM business_sys_interaction_log WHERE 1=1 AND interaction_key = ? LIMIT 1` err = o.Raw(sql, key).QueryRow(&item) return }