comein_event_user.go 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. package yb
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. // ComeinEventUser 进门会议用户表
  7. type ComeinEventUser struct {
  8. ComeinUserId int `orm:"column(comein_user_id);pk" description:"自增id"`
  9. ComeinEventId int `orm:"column(comein_event_id)" description:"活动与进门会议的关系id"`
  10. ComeinDataId int `orm:"column(comein_data_id)" description:"进门会议的数据id,用作数据去重"`
  11. UserId int `description:"用户id"`
  12. Mobile string `description:"手机号"`
  13. Email string `description:"邮箱"`
  14. Name string `description:"姓名"`
  15. FirstWatchTime time.Time `description:"首次入会时间"`
  16. LastWatchTime time.Time `description:"最后退出会议时间"`
  17. JoinTime int `description:"会议参与时长"`
  18. AuthInfo string `description:"用户参与鉴权"`
  19. JoinType int `description:"参与方式 1:网络 2:电话"`
  20. DataType int `description:"数据类型,1:直播 2:回放"`
  21. RegisterTime time.Time `description:"用户注册时间"`
  22. ViewTotal int `description:"报告累计阅读次数"`
  23. LastViewTime time.Time `description:"报告最近一次阅读时间"`
  24. CompanyId int `description:"客户id"`
  25. ProductId int `description:"产品id"`
  26. CompanyName string `description:"客户名称"`
  27. Occupation string `description:"职位"`
  28. Status string `description:"客户产品状态"`
  29. SellerId int `description:"所属销售id"`
  30. SellerName string `description:"所属销售名称"`
  31. CompanyViewTotal int `description:"客户总计阅读次数"`
  32. CompanyRoadTotal int `description:"客户路演次数"`
  33. CreateTime time.Time `description:"记录创建时间"`
  34. }
  35. // TableName 表名变更
  36. func (comeinEventUserInfo *ComeinEventUser) TableName() string {
  37. return "comein_event_user"
  38. }
  39. // AddComeinEventUser 新增进门会议用户
  40. func AddComeinEventUser(comeinEventUserInfo *ComeinEventUser) (err error) {
  41. o := orm.NewOrm()
  42. id, err := o.Insert(comeinEventUserInfo)
  43. if err != nil {
  44. return
  45. }
  46. comeinEventUserInfo.ComeinUserId = int(id)
  47. return
  48. }
  49. // GetQsUserList 获取到会用户列表数据
  50. func GetComeinUserList(condition string, pars []interface{}, startSize, pageSize int) (total int, list []*ComeinEventUser, err error) {
  51. o := orm.NewOrm()
  52. sql := "select * from comein_event_user a where 1=1 "
  53. sql += condition
  54. sql += ` order by a.comein_user_id desc`
  55. totalSql := `select count(1) total from (` + sql + `) z `
  56. err = o.Raw(totalSql, pars).QueryRow(&total)
  57. if err != nil {
  58. return
  59. }
  60. sql += ` LIMIT ?,? `
  61. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&list)
  62. return
  63. }
  64. // GetComeinEventUserByComeinDataId 根据进门会议的数据id获取记录
  65. func GetComeinEventUserByComeinDataId(comeinId int) (item *ComeinEventUser, err error) {
  66. o := orm.NewOrm()
  67. sql := "select * from comein_event_user where comein_data_id=? "
  68. err = o.Raw(sql, comeinId).QueryRow(&item)
  69. return
  70. }
  71. // GetComeinUserListForExport 获取到会用户列表数据
  72. func GetComeinUserListForExport(condition string, pars []interface{}) (total int, list []*ComeinEventUser, err error) {
  73. o := orm.NewOrm()
  74. sql := "select * from comein_event_user a where 1=1 "
  75. sql += condition
  76. sql += ` order by a.comein_user_id desc`
  77. totalSql := `select count(1) total from (` + sql + `) z `
  78. err = o.Raw(totalSql, pars).QueryRow(&total)
  79. if err != nil {
  80. return
  81. }
  82. _, err = o.Raw(sql, pars).QueryRows(&list)
  83. return
  84. }