package models

import (
	"github.com/beego/beego/v2/client/orm"
	"time"
)

type CygxUserFollowSpecial struct {
	Id          int       `orm:"column(id);pk"`
	UserId      int       `description:"用户ID"`
	CreateTime  time.Time `description:"创建时间"`
	Mobile      string    `description:"手机号"`
	Email       string    `description:"邮箱"`
	CompanyId   int       `description:"公司id"`
	CompanyName string    `description:"公司名称"`
	RealName    string    `description:"用户实际名称"`
}

//添加
func AddUserFollowSpecial(item *CygxUserFollowSpecial) (err error) {
	o := orm.NewOrm()
	_, err = o.Insert(item)
	return
}

//获取某一用户的报名的数量
func GetCygxUserFollowSpecial(uid int) (count int, err error) {
	sqlCount := `SELECT COUNT(1) AS count FROM cygx_user_follow_special  WHERE  user_id=? `
	o := orm.NewOrm()
	err = o.Raw(sqlCount, uid).QueryRow(&count)
	return
}

//删除
func DeleteCygxUserFollowSpecial(uid int) (err error) {
	o := orm.NewOrm()
	sql := `DELETE  FROM cygx_user_follow_special   WHERE  user_id=? `
	_, err = o.Raw(sql, uid).Exec()
	return
}
