business_sys_interaction_log.go 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package data_manage
  2. import (
  3. "eta_gn/eta_task/global"
  4. "time"
  5. )
  6. type BusinessSysInteractionLog struct {
  7. ID uint32 `gorm:"primaryKey;column:id;type:int(10) unsigned;not null" json:"-"`
  8. InteractionKey string `gorm:"unique;column:interaction_key;type:varchar(128);not null;default:''" json:"interactionKey"` // 记录Key
  9. InteractionVal string `gorm:"column:interaction_val;type:text;default:null" json:"interactionVal"` // 记录值
  10. Remark string `gorm:"column:remark;type:varchar(128);not null;default:''" json:"remark"` // 备注
  11. ModifyTime time.Time `gorm:"column:modify_time;type:datetime;default:null" json:"modifyTime"` // 修改日期
  12. CreateTime time.Time `gorm:"column:create_time;type:datetime;default:null" json:"createTime"` // 创建时间
  13. }
  14. func (m *BusinessSysInteractionLog) TableName() string {
  15. return "business_sys_interaction_log"
  16. }
  17. var BusinessSysInteractionLogColumns = struct {
  18. ID string
  19. InteractionKey string
  20. InteractionVal string
  21. Remark string
  22. ModifyTime string
  23. CreateTime string
  24. }{
  25. ID: "id",
  26. InteractionKey: "interaction_key",
  27. InteractionVal: "interaction_val",
  28. Remark: "remark",
  29. ModifyTime: "modify_time",
  30. CreateTime: "create_time",
  31. }
  32. func (m *BusinessSysInteractionLog) Create() (err error) {
  33. err = global.DEFAULT_DmSQL.Create(m).Error
  34. if err != nil {
  35. return
  36. }
  37. return
  38. }
  39. func (m *BusinessSysInteractionLog) Update(cols []string) (err error) {
  40. err = global.DEFAULT_DmSQL.Select(cols).Updates(m).Error
  41. return
  42. }
  43. var BinlogFileNameKey = "binlog_filename" // binlog文件名
  44. var BinlogPositionKey = "binlog_binlog_position" // binlog位置
  45. var CrmIndexLastUpdateTime = "crm_index_update_time" // crm数据
  46. func GetBusinessSysInteractionLogByKey(key string) (item *BusinessSysInteractionLog, err error) {
  47. sql := `SELECT * FROM business_sys_interaction_log WHERE 1=1 AND interaction_key = ? LIMIT 1`
  48. err = global.DEFAULT_DmSQL.Raw(sql, key).First(&item).Error
  49. return
  50. }