english_company_todo_public.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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;primaryKey" 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. err = global.DmSQL["rddp"].Create(item).Error
  29. return
  30. }
  31. func (item *EnglishCompanyTodoPublic) Update(cols []string) (err error) {
  32. err = global.DmSQL["rddp"].Select(cols).Updates(item).Error
  33. return
  34. }
  35. // EnglishCompanyTodoPublicAddReq 新增公共任务请求
  36. type EnglishCompanyTodoPublicAddReq struct {
  37. Description string `description:"任务描述"`
  38. }
  39. // GetLastEnglishCompanyTodoPublic 获取最新的公共任务TODO
  40. func GetLastEnglishCompanyTodoPublic() (item *EnglishCompanyTodoPublic, err error) {
  41. sql := `SELECT * FROM english_company_todo_public ORDER BY create_time DESC LIMIT 1`
  42. err = global.DmSQL["rddp"].Raw(sql).First(&item).Error
  43. return
  44. }