activity_offline_meeting_detail.go 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. // 报名
  7. type CygxActivityOfflineMeetingDetail struct {
  8. Id int `orm:"column(id);pk"`
  9. UserId int `description:"用户id"`
  10. ActivityId int `description:"活动ID"`
  11. CreateTime time.Time `description:"创建时间"`
  12. Mobile string `description:"手机号"`
  13. Email string `description:"邮箱号"`
  14. CompanyId int `description:"公司ID"`
  15. CompanyName string `description:"公司名称"`
  16. IsMeeting int `description:"是否到会 1.是 ,0否"`
  17. SigninTime string `description:"签到时间"`
  18. }
  19. // 列表
  20. func GetOfflineMeetingList(condition string, pars []interface{}) (items []*CygxActivitySignupList, err error) {
  21. o := orm.NewOrm()
  22. sql := `SELECT *
  23. FROM cygx_activity_offline_meeting_detail WHERE 1 =1 ` + condition
  24. _, err = o.Raw(sql, pars).QueryRows(&items)
  25. return
  26. }
  27. // 批量添加
  28. func AddCygxActivityOfflineMeetingDetailList(items []*CygxActivityOfflineMeetingDetail) (lastId int64, err error) {
  29. lenitems := len(items)
  30. if lenitems == 0 {
  31. return
  32. }
  33. o := orm.NewOrm()
  34. _, err = o.InsertMulti(1, items)
  35. return
  36. }
  37. // 添加
  38. func AddCygxActivityOfflineMeetingDetail(item *CygxActivityOfflineMeetingDetail) (err error) {
  39. o := orm.NewOrm()
  40. _, err = o.Insert(item)
  41. return
  42. }
  43. // 获取数量
  44. func GetCygxActivityOfflineMeetingDetailCount(condition string, pars []interface{}) (count int, err error) {
  45. sqlCount := ` SELECT COUNT(1) AS count FROM cygx_activity_offline_meeting_detail as art WHERE 1= 1 `
  46. if condition != "" {
  47. sqlCount += condition
  48. }
  49. o := orm.NewOrm()
  50. err = o.Raw(sqlCount, pars).QueryRow(&count)
  51. return
  52. }
  53. // UpdateCygxActivityOfflineMeetingDetailSigninTime 修改签到时间
  54. func UpdateCygxActivityOfflineMeetingDetailSigninTime(activityId, userId int) (err error) {
  55. o := orm.NewOrm()
  56. sql := `UPDATE cygx_activity_offline_meeting_detail SET signin_time = NOW() ,is_meeting = 1 WHERE activity_id = ? AND user_id = ? `
  57. _, err = o.Raw(sql, activityId, userId).Exec()
  58. return
  59. }
  60. // 预约外呼列表
  61. func GetOfflineMeetingListByUser(meetingUids string, activityId int) (items []*CygxActivityOfflineMeetingDetail, err error) {
  62. o := orm.NewOrm()
  63. sql := `SELECT s.* FROM cygx_activity_offline_meeting_detail as s WHERE activity_id = ? AND user_id IN (` + meetingUids + `)`
  64. _, err = o.Raw(sql, activityId).QueryRows(&items)
  65. return
  66. }
  67. // 报名
  68. type CygxActivityOfflineMeetingDetailResp struct {
  69. ActivityId int `description:"活动ID "`
  70. ActivityName string `description:"活动名称"`
  71. List []*CygxActivitySignupResp
  72. }
  73. // 预约外呼列表
  74. func GetOfflineMeetingListWithUser(condition string, pars []interface{}) (items []*CygxActivitySignupList, err error) {
  75. o := orm.NewOrm()
  76. sql := `SELECT s.*
  77. FROM cygx_activity_offline_meeting_detail as s
  78. WHERE 1 =1 ` + condition
  79. _, err = o.Raw(sql, pars).QueryRows(&items)
  80. return
  81. }