activity_signup_break.go 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "hongze/hongze_mfyx/utils"
  5. "time"
  6. )
  7. type CygxActivitySignupBreak struct {
  8. Id int `orm:"column(id);pk"`
  9. ActivityId int `description:"活动ID"`
  10. UserId 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. RealName string `description:"用户实际名称"`
  17. SellerName string `description:"所属销售"`
  18. }
  19. // 添加爽约记录
  20. func AddCygxActivitySignupBreak(item *CygxActivitySignupBreak) (lastId int64, err error) {
  21. o := orm.NewOrm()
  22. lastId, err = o.Insert(item)
  23. return
  24. }
  25. // 批量添加
  26. func AddCygxActivitySignupBreakList(items []*CygxActivitySignupBreak) (lastId int64, err error) {
  27. lenitems := len(items)
  28. if lenitems == 0 {
  29. return
  30. }
  31. o := orm.NewOrm()
  32. _, err = o.InsertMulti(1, items)
  33. return
  34. }
  35. // 删除
  36. func DeleteCygxActivitySignupBreak(uid, activityId int) (err error) {
  37. o := orm.NewOrm()
  38. sql := ` DELETE FROM cygx_activity_signup_break WHERE user_id=? AND activity_id =? `
  39. _, err = o.Raw(sql, uid, activityId).Exec()
  40. return
  41. }
  42. // 删除
  43. func DeleteCygxActivitySignupBreakById(activityId int) (err error) {
  44. o := orm.NewOrm()
  45. sql := ` DELETE FROM cygx_activity_signup_break WHERE activity_id =? `
  46. _, err = o.Raw(sql, activityId).Exec()
  47. return
  48. }
  49. // 批量删除
  50. func DeleteCygxActivitySignupBreakByIds(activityIds []int) (err error) {
  51. lenactivityIds := len(activityIds)
  52. if lenactivityIds == 0 {
  53. return
  54. }
  55. o := orm.NewOrm()
  56. sql := ` DELETE FROM cygx_activity_signup_break WHERE activity_id IN (` + utils.GetOrmInReplace(lenactivityIds) + `)`
  57. _, err = o.Raw(sql, activityIds).Exec()
  58. return
  59. }