user_follow_special.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CygxUserFollowSpecial struct {
  7. Id int `orm:"column(id);pk"`
  8. UserId int `description:"用户ID"`
  9. CreateTime time.Time `description:"创建时间"`
  10. Mobile string `description:"手机号"`
  11. Email string `description:"邮箱"`
  12. CompanyId int `description:"公司id"`
  13. CompanyName string `description:"公司名称"`
  14. RealName string `description:"用户实际名称"`
  15. }
  16. //添加
  17. func AddUserFollowSpecial(item *CygxUserFollowSpecial) (err error) {
  18. o := orm.NewOrm()
  19. _, err = o.Insert(item)
  20. return
  21. }
  22. //获取某一用户的报名的数量
  23. func GetCygxUserFollowSpecial(uid int) (count int, err error) {
  24. sqlCount := `SELECT COUNT(1) AS count FROM cygx_user_follow_special WHERE user_id=? `
  25. o := orm.NewOrm()
  26. err = o.Raw(sqlCount, uid).QueryRow(&count)
  27. return
  28. }
  29. //删除
  30. func DeleteCygxUserFollowSpecial(uid int) (err error) {
  31. o := orm.NewOrm()
  32. sql := `DELETE FROM cygx_user_follow_special WHERE user_id=? `
  33. _, err = o.Raw(sql, uid).Exec()
  34. return
  35. }