english_company_todo_public.go 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package models
  2. import (
  3. "eta/eta_api/global"
  4. "eta/eta_api/utils"
  5. "time"
  6. )
  7. // EnglishCompanyTodoPublic 英文客户公共TODO任务
  8. type EnglishCompanyTodoPublic struct {
  9. Id int `gorm:"column:id;primaryKey;autoIncrement"`
  10. Content string `description:"任务描述"`
  11. CreateUserId int `description:"创建人用户id"`
  12. CreateUserName string `description:"创建人用户姓名"`
  13. ModifyTime time.Time `description:"修改时间"`
  14. CreateTime time.Time `description:"创建时间"`
  15. IsDelete int `json:"-" description:"是否已经删除,0:未删除,1:已删除;默认:0"`
  16. }
  17. func (item *EnglishCompanyTodoPublic) TableName() string {
  18. return "english_company_todo_public"
  19. }
  20. // EnglishCompanyTodoPublicResp 英文客户公共TODO响应体
  21. type EnglishCompanyTodoPublicResp struct {
  22. Content string `description:"任务描述"`
  23. CreateUserId int `description:"创建人用户id"`
  24. CreateUserName string `description:"创建人用户姓名"`
  25. ModifyTime string `description:"修改时间"`
  26. CreateTime string `description:"创建时间"`
  27. }
  28. func (item *EnglishCompanyTodoPublic) Create() (err error) {
  29. err = global.DbMap[utils.DbNameReport].Create(item).Error
  30. return
  31. }
  32. func (item *EnglishCompanyTodoPublic) Update(cols []string) (err error) {
  33. err = global.DbMap[utils.DbNameReport].Select(cols).Updates(item).Error
  34. return
  35. }
  36. // EnglishCompanyTodoPublicAddReq 新增公共任务请求
  37. type EnglishCompanyTodoPublicAddReq struct {
  38. Description string `description:"任务描述"`
  39. }
  40. // GetLastEnglishCompanyTodoPublic 获取最新的公共任务TODO
  41. func GetLastEnglishCompanyTodoPublic() (item *EnglishCompanyTodoPublic, err error) {
  42. o := global.DbMap[utils.DbNameReport]
  43. sql := `SELECT * FROM english_company_todo_public ORDER BY create_time DESC LIMIT 1`
  44. err = o.Raw(sql).First(&item).Error
  45. return
  46. }