english_company_todo_public.go 1.9 KB

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