activity_meet_detail_log.go 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package models
  2. import (
  3. "github.com/rdlucklib/rdluck_tools/orm"
  4. "time"
  5. )
  6. //报名
  7. type CygxActivityMeetDetailLog struct {
  8. AttendanceId int `orm:"column(attendance_id);pk;"description:"主键ID"`
  9. ActivityId int `description:"活动ID"`
  10. RealName string `description:"姓名"`
  11. Mobile string `description:"手机号"`
  12. CompanyName string `description:"公司名称"`
  13. CompanyId int `description:"公司id 不在数据库的用户为0"`
  14. CreateTime time.Time `description:"创建时间"`
  15. }
  16. func GetOfflineMeetingDetailList() (item []*CygxActivityMeetDetailLog, err error) {
  17. o := orm.NewOrm()
  18. sql := `SELECT * FROM cygx_activity_offline_meeting_detail WHERE is_meeting = 1`
  19. _, err = o.Raw(sql).QueryRows(&item)
  20. return
  21. }
  22. //添加优化建议
  23. func AddCygxActivityMeetDetailLog(item *CygxActivityMeetDetailLog) (lastId int64, err error) {
  24. o := orm.NewOrm()
  25. lastId, err = o.Insert(item)
  26. return
  27. }
  28. func GetActivityMeetDetailLog() (item []*CygxActivityMeetDetailLog, err error) {
  29. o := orm.NewOrm()
  30. sql := `SELECT * FROM cygx_activity_meet_detail_log WHERE company_name !='' GROUP BY company_name `
  31. _, err = o.Raw(sql).QueryRows(&item)
  32. return
  33. }
  34. func GetActivityMeetDetailLogByMobile() (item []*CygxActivityMeetDetailLog, err error) {
  35. o := orm.NewOrm()
  36. sql := `SELECT * FROM cygx_activity_meet_detail_log WHERE mobile !='' GROUP BY mobile `
  37. _, err = o.Raw(sql).QueryRows(&item)
  38. return
  39. }
  40. //获取数量
  41. func GetActivityMeetDetailLogCount(condition string) (count int, err error) {
  42. o := orm.NewOrm()
  43. sqlCount := ` SELECT COUNT(1) AS count FROM cygx_activity_meet_detail_log WHERE 1=1 `
  44. if condition != "" {
  45. sqlCount += condition
  46. }
  47. err = o.Raw(sqlCount).QueryRow(&count)
  48. return
  49. }
  50. //修改公司参会数量
  51. func UpdateActivityMeetDetailLog(companyName string, num int) (err error) {
  52. sql := ` UPDATE cygx_activity_meet_detail_log SET company_meet_num= ? WHERE company_name = ?`
  53. o := orm.NewOrm()
  54. _, err = o.Raw(sql, num, companyName).Exec()
  55. return
  56. }
  57. //修改个人参会数量
  58. func UpdateActivityMeetDetailLogByUser(mobile string, num int) (err error) {
  59. sql := ` UPDATE cygx_activity_meet_detail_log SET user_meet_num= ? WHERE mobile = ?`
  60. o := orm.NewOrm()
  61. _, err = o.Raw(sql, num, mobile).Exec()
  62. return
  63. }