qs_event_user.go 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package yb
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. // QsEventUser 全时会议用户表
  7. type QsEventUser struct {
  8. QsUserId int `orm:"column(qs_user_id);pk" description:"自增id"`
  9. QsId int `orm:"column(qs_id)" description:"活动与全时会议的关系id"`
  10. UserId int `description:"用户id"`
  11. Mobile string `description:"手机号"`
  12. Email string `description:"邮箱"`
  13. Name string `description:"姓名"`
  14. RegisterTime time.Time `description:"用户注册时间"`
  15. ViewTotal int `description:"报告累计阅读次数"`
  16. LastViewTime time.Time `description:"报告最近一次阅读时间"`
  17. CompanyId int `description:"客户id"`
  18. ProductId int `description:"产品id"`
  19. CompanyName string `description:"客户名称"`
  20. Status string `description:"客户产品状态"`
  21. SellerId int `description:"所属销售id"`
  22. SellerName string `description:"所属销售名称"`
  23. CompanyViewTotal int `description:"客户总计阅读次数"`
  24. CompanyRoadTotal int `description:"客户路演次数"`
  25. CreateTime time.Time `description:"记录创建时间"`
  26. }
  27. // TableName 表名变更
  28. func (qsEventUserInfo *QsEventUser) TableName() string {
  29. return "qs_event_user"
  30. }
  31. // AddQsEventUser 新增全时会议用户
  32. func AddQsEventUser(qsEventUser *QsEventUser) (err error) {
  33. o := orm.NewOrm()
  34. id, err := o.Insert(qsEventUser)
  35. if err != nil {
  36. return
  37. }
  38. qsEventUser.QsUserId = int(id)
  39. return
  40. }
  41. // GetQsUserList 获取到会用户列表数据
  42. func GetQsUserList(condition string, pars []interface{}, startSize, pageSize int) (total int, list []*QsEventUser, err error) {
  43. o := orm.NewOrm()
  44. sql := "select * from qs_event_user a where 1=1 "
  45. sql += condition
  46. sql += ` order by a.qs_user_id desc`
  47. totalSql := `select count(1) total from (` + sql + `) z `
  48. err = o.Raw(totalSql, pars).QueryRow(&total)
  49. if err != nil {
  50. return
  51. }
  52. sql += ` LIMIT ?,? `
  53. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&list)
  54. return
  55. }
  56. // GetQsUserListForExport 获取到会用户列表数据
  57. func GetQsUserListForExport(condition string, pars []interface{}) (total int, list []*QsEventUser, err error) {
  58. o := orm.NewOrm()
  59. sql := "select * from qs_event_user a where 1=1 "
  60. sql += condition
  61. sql += ` order by a.qs_user_id desc`
  62. totalSql := `select count(1) total from (` + sql + `) z `
  63. err = o.Raw(totalSql, pars).QueryRow(&total)
  64. if err != nil {
  65. return
  66. }
  67. _, err = o.Raw(sql, pars).QueryRows(&list)
  68. return
  69. }