english_company_log.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package models
  2. import (
  3. "eta_gn/eta_api/global"
  4. "time"
  5. )
  6. const (
  7. EnglishCompanyLogOptionTypeAdd = iota + 1
  8. EnglishCompanyLogOptionTypeEdit
  9. EnglishCompanyLogOptionTypeDel
  10. EnglishCompanyLogOptionTypeEditEnabled
  11. EnglishCompanyLogOptionTypeSavePermission
  12. )
  13. // EnglishCompanyLog 英文客户操作日志表
  14. type EnglishCompanyLog struct {
  15. Id int `gorm:"column:id;primary_key:true" description:"日志ID"`
  16. CompanyId int `gorm:"column:company_id" description:"英文客户ID"`
  17. AdminId int `gorm:"column:admin_id" description:"操作人ID"`
  18. OptionData string `gorm:"column:option_data" description:"操作数据-JSON"`
  19. OptionType int `gorm:"column:option_type" description:"操作类型:1-新增;2-编辑;3-删除"`
  20. CreateTime time.Time `gorm:"column:create_time" description:"创建时间"`
  21. }
  22. func (item *EnglishCompanyLog) TableName() string {
  23. return "english_company_log"
  24. }
  25. func (item *EnglishCompanyLog) Create() (err error) {
  26. //o := orm.NewOrmUsingDB("rddp")
  27. //id, err := o.Insert(item)
  28. //if err != nil {
  29. // return
  30. //}
  31. //item.Id = int(id)
  32. err = global.DmSQL["rddp"].Create(item).Error
  33. return
  34. }
  35. func (item *EnglishCompanyLog) Update(cols []string) (err error) {
  36. //o := orm.NewOrmUsingDB("rddp")
  37. //_, err = o.Update(item, cols...)
  38. err = global.DmSQL["rddp"].Select(cols).Updates(item).Error
  39. return
  40. }