package cygx import ( "github.com/beego/beego/v2/client/orm" ) type ArticleComment struct { Id int `description:"主键ID"` ArticleId int `description:"活动ID"` UserId int `description:"用户ID"` CreateTime string `description:"创建时间"` Mobile string `description:"手机号"` CompanyName string `description:"公司名称"` RealName string `description:"姓名"` Content string `description:"内容"` } type ArticleCommentListResp struct { List []*ArticleComment } //列表 func GetArticleCommentList(articleId int) (items []*ArticleComment, err error) { o := orm.NewOrm() sql := `SELECT k.*,u.real_name FROM cygx_article_comment as k LEFT JOIN wx_user as u ON u.mobile = k.mobile WHERE article_id = ? ORDER BY create_time DESC` _, err = o.Raw(sql, articleId).QueryRows(&items) return } //列表 func GetArticleCommentListByVideoId(videoId int) (items []*ArticleComment, err error) { o := orm.NewOrm() sql := `SELECT k.*,u.real_name FROM cygx_article_comment as k LEFT JOIN wx_user as u ON u.mobile = k.mobile WHERE video_id = ? ORDER BY create_time DESC` _, err = o.Raw(sql, videoId).QueryRows(&items) return } //列表 func GetArticleCommentListByActivityVideoId(videoId int) (items []*ArticleComment, err error) { o := orm.NewOrm() sql := `SELECT k.*,u.real_name FROM cygx_article_comment as k LEFT JOIN wx_user as u ON u.mobile = k.mobile WHERE video_id = ? ORDER BY create_time DESC` _, err = o.Raw(sql, videoId).QueryRows(&items) return } //留言列表 func GetArticleCommentListSearch(condition string, pars []interface{}) (items []*ArticleComment, err error) { o := orm.NewOrm() sql := ` SELECT k.*,u.real_name FROM cygx_article_comment as k LEFT JOIN wx_user as u ON u.mobile = k.mobile WHERE 1= 1 ` + condition + ` ORDER BY create_time DESC ` _, err = o.Raw(sql, pars).QueryRows(&items) return }