package models import ( "github.com/beego/beego/v2/client/orm" "hongze/hongze_cygx/utils" "time" ) type CygxActivitySignupBreak struct { Id int `orm:"column(id);pk"` ActivityId int `description:"活动ID"` UserId int `description:"用户ID"` CreateTime time.Time `description:"创建时间"` Mobile string `description:"手机号"` Email string `description:"邮箱"` CompanyId int `description:"公司id"` CompanyName string `description:"公司名称"` RealName string `description:"用户实际名称"` SellerName string `description:"所属销售"` } // 添加爽约记录 func AddCygxActivitySignupBreak(item *CygxActivitySignupBreak) (lastId int64, err error) { o := orm.NewOrm() lastId, err = o.Insert(item) return } // 批量添加 func AddCygxActivitySignupBreakList(items []*CygxActivitySignupBreak) (lastId int64, err error) { lenitems := len(items) if lenitems == 0 { return } o := orm.NewOrm() _, err = o.InsertMulti(1, items) return } // 删除 func DeleteCygxActivitySignupBreak(uid, activityId int) (err error) { o := orm.NewOrm() sql := ` DELETE FROM cygx_activity_signup_break WHERE user_id=? AND activity_id =? ` _, err = o.Raw(sql, uid, activityId).Exec() return } // 删除 func DeleteCygxActivitySignupBreakById(activityId int) (err error) { o := orm.NewOrm() sql := ` DELETE FROM cygx_activity_signup_break WHERE activity_id =? ` _, err = o.Raw(sql, activityId).Exec() return } // 批量删除 func DeleteCygxActivitySignupBreakByIds(activityIds []int) (err error) { lenactivityIds := len(activityIds) if lenactivityIds == 0 { return } o := orm.NewOrm() sql := ` DELETE FROM cygx_activity_signup_break WHERE activity_id IN (` + utils.GetOrmInReplace(lenactivityIds) + `)` _, err = o.Raw(sql, activityIds).Exec() return }