package models import ( "github.com/beego/beego/v2/client/orm" ) type CygxArticleAuthor struct { Id int `orm:"column(id);pk;"description:"主键ID"` ArticleId int `description:"文章ID"` Mobile string `description:"手机号"` Name string `description:"姓名"` } //获取数量 func GetActivityAuthorCount(articcleId int, mobile string) (count int, err error) { o := orm.NewOrm() sqlCount := ` SELECT COUNT(1) AS count FROM cygx_article_author WHERE article_id=? AND mobile = ? ` err = o.Raw(sqlCount, articcleId, mobile).QueryRow(&count) return } //添加优化建议 func AddCygxActivityAuthor(item *CygxArticleAuthor) (lastId int64, err error) { o := orm.NewOrm() lastId, err = o.Insert(item) return }