english_company_todo_public.go 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package models
  2. import (
  3. "eta_gn/eta_api/global"
  4. "time"
  5. )
  6. // EnglishCompanyTodoPublic 英文客户公共TODO任务
  7. type EnglishCompanyTodoPublic struct {
  8. Id int `gorm:"column:id;primary_key:true" description:"任务ID"`
  9. Content string `gorm:"column:content" description:"任务描述"`
  10. CreateUserId int `gorm:"column:create_user_id" description:"创建人用户ID"`
  11. CreateUserName string `gorm:"column:create_user_name" description:"创建人用户姓名"`
  12. ModifyTime time.Time `gorm:"column:modify_time" description:"修改时间"`
  13. CreateTime time.Time `gorm:"column:create_time" description:"创建时间"`
  14. IsDelete int `gorm:"column:is_delete;default:0" 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. err = global.DmSQL["rddp"].Create(item).Error
  35. return
  36. }
  37. func (item *EnglishCompanyTodoPublic) Update(cols []string) (err error) {
  38. //o := orm.NewOrmUsingDB("rddp")
  39. //_, err = o.Update(item, cols...)
  40. err = global.DmSQL["rddp"].Select(cols).Updates(item).Error
  41. return
  42. }
  43. // EnglishCompanyTodoPublicAddReq 新增公共任务请求
  44. type EnglishCompanyTodoPublicAddReq struct {
  45. Description string `description:"任务描述"`
  46. }
  47. // GetLastEnglishCompanyTodoPublic 获取最新的公共任务TODO
  48. func GetLastEnglishCompanyTodoPublic() (item *EnglishCompanyTodoPublic, err error) {
  49. //o := orm.NewOrmUsingDB("rddp")
  50. sql := `SELECT * FROM english_company_todo_public ORDER BY create_time DESC LIMIT 1`
  51. //err = o.Raw(sql).QueryRow(&item)
  52. err = global.DmSQL["rddp"].Raw(sql).First(&item).Error
  53. return
  54. }