article_comment.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package cygx
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. )
  5. type ArticleComment struct {
  6. Id int `description:"主键ID"`
  7. ArticleId int `description:"活动ID"`
  8. UserId int `description:"用户ID"`
  9. CreateTime string `description:"创建时间"`
  10. Mobile string `description:"手机号"`
  11. CompanyName string `description:"公司名称"`
  12. RealName string `description:"姓名"`
  13. Content string `description:"内容"`
  14. }
  15. type ArticleCommentListResp struct {
  16. List []*ArticleComment
  17. }
  18. // 列表
  19. func GetArticleCommentList(articleId int) (items []*ArticleComment, err error) {
  20. o := orm.NewOrmUsingDB("hz_cygx")
  21. sql := `SELECT k.*
  22. FROM cygx_article_comment as k
  23. WHERE article_id = ? ORDER BY create_time DESC`
  24. _, err = o.Raw(sql, articleId).QueryRows(&items)
  25. return
  26. }
  27. // 留言列表
  28. func GetArticleCommentListSearch(condition string, pars []interface{}) (items []*ArticleComment, err error) {
  29. o := orm.NewOrmUsingDB("hz_cygx")
  30. sql := ` SELECT k.*
  31. FROM cygx_article_comment as k
  32. WHERE 1= 1 ` + condition + ` ORDER BY create_time DESC `
  33. _, err = o.Raw(sql, pars).QueryRows(&items)
  34. return
  35. }