business_sys_interaction_log.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. package binlog
  2. import (
  3. "time"
  4. "eta/eta_api/global"
  5. "eta/eta_api/utils"
  6. )
  7. // BusinessSysInteractionLog 商家系统交互记录表
  8. type BusinessSysInteractionLog struct {
  9. ID uint32 `orm:"column(id);pk" gorm:"primaryKey"`
  10. InteractionKey string // 记录Key
  11. InteractionVal string // 记录值
  12. Remark string // 备注
  13. ModifyTime time.Time // 修改日期
  14. CreateTime time.Time // 创建时间
  15. }
  16. // TableName get sql table name.获取数据库表名
  17. func (m *BusinessSysInteractionLog) TableName() string {
  18. return "business_sys_interaction_log"
  19. }
  20. // BusinessSysInteractionLogColumns get sql column name.获取数据库列名
  21. var BusinessSysInteractionLogColumns = struct {
  22. ID string
  23. InteractionKey string
  24. InteractionVal string
  25. Remark string
  26. ModifyTime string
  27. CreateTime string
  28. }{
  29. ID: "id",
  30. InteractionKey: "interaction_key",
  31. InteractionVal: "interaction_val",
  32. Remark: "remark",
  33. ModifyTime: "modify_time",
  34. CreateTime: "create_time",
  35. }
  36. // Create 添加数据
  37. func (m *BusinessSysInteractionLog) Create() (err error) {
  38. o := global.DbMap[utils.DbNameIndex]
  39. err = o.Create(m).Error
  40. return
  41. }
  42. // Update 更新数据
  43. func (m *BusinessSysInteractionLog) Update(cols []string) (err error) {
  44. o := global.DbMap[utils.DbNameIndex]
  45. err = o.Model(m).Select(cols).Updates(m).Error
  46. return
  47. }
  48. var BinlogFileNameKey = "binlog_edb_info_filename" // binlog文件名
  49. var BinlogPositionKey = "binlog_edb_info_position" // binlog位置
  50. // GetBusinessSysInteractionLogByKey 根据记录key获取数据
  51. func GetBusinessSysInteractionLogByKey(key string) (item *BusinessSysInteractionLog, err error) {
  52. o := global.DbMap[utils.DbNameIndex]
  53. sql := "SELECT * FROM business_sys_interaction_log WHERE interaction_key = ?"
  54. err = o.Raw(sql, key).First(&item).Error
  55. return
  56. }