yb_community_question_process.go 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package yb
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. const (
  7. // 流程类型: 1-分配; 2-转移
  8. ProcessTypeDistribute = 1
  9. ProcessTypeTransfer = 2
  10. )
  11. // CommunityQuestionProcess 问答社区流程表
  12. type CommunityQuestionProcess struct {
  13. Id int `orm:"column(id);pk" json:"-"`
  14. CommunityQuestionId int `json:"community_question_id"`
  15. TransferUserId int `json:"transfer_user_id"`
  16. TransferAdminId int `json:"transfer_admin_id"`
  17. TransferAdminName string `json:"transfer_admin_name"`
  18. ReplierUserId int `json:"replier_user_id"`
  19. ReplierAdminId int `json:"replier_admin_id"`
  20. ReplierAdminName string `json:"replier_admin_name"`
  21. Remark string `json:"remark"`
  22. ProcessType int `json:"process_type"`
  23. CreateTime time.Time `json:"create_time"`
  24. VarietyClassifyId int `json:"variety_classify_id"`
  25. VarietyTagId int `json:"variety_tag_id"`
  26. }
  27. func (item *CommunityQuestionProcess) TableName() string {
  28. return "yb_community_question_process"
  29. }
  30. func (item *CommunityQuestionProcess) Create() (err error) {
  31. o := orm.NewOrmUsingDB("weekly")
  32. id, err := o.Insert(item)
  33. if err != nil {
  34. return
  35. }
  36. item.Id = int(id)
  37. return
  38. }
  39. // CommunityQuestionProcessItem 问答社区流程
  40. type CommunityQuestionProcessItem struct {
  41. CommunityQuestionId int
  42. TransferUserId int
  43. TransferAdminId int
  44. TransferAdminName string
  45. ReplierUserId int
  46. ReplierAdminId int
  47. ReplierAdminName string
  48. Remark string
  49. ProcessType int
  50. CreateTime string
  51. VarietyClassifyId int
  52. VarietyTagId int
  53. }
  54. // GetCommunityQuestionProcessItemList 根据问答ID获取流程
  55. func GetCommunityQuestionProcessItemList(questionId int) (list []*CommunityQuestionProcessItem, err error) {
  56. list = make([]*CommunityQuestionProcessItem, 0)
  57. o := orm.NewOrmUsingDB("weekly")
  58. sql := `SELECT * FROM yb_community_question_process WHERE community_question_id = ? ORDER BY create_time DESC`
  59. _, err = o.Raw(sql, questionId).QueryRows(&list)
  60. return
  61. }