package models import ( "github.com/beego/beego/v2/client/orm" ) type CygxArticleDataResp struct { ArticleId int `description:"文章id"` Stock string `description:"文章个股标签"` Cover string `description:"封面图片,公司logo"` } type ArticleDataLogoResp struct { ArticleId int `description:"文章id"` Cover string `description:"封面图片,公司logo"` ComapnyList []*ComapnyNameResp `description:"公司名称"` } type ArticleDataLogoListResp struct { List []*ArticleDataLogoResp } type ComapnyNameResp struct { ComapnyName string `description:"公司民称"` } // 列表 func CygxArticleDataList(condition string, pars []interface{}) (items []*CygxArticleDataResp, err error) { o := orm.NewOrm() sql := `SELECT a.article_id, a.stock, d.cover FROM cygx_article AS a INNER JOIN cygx_article_data AS d ON d.article_id = a.article_id WHERE 1 = 1 AND a.publish_status = 1 ` if condition != "" { sql += condition } _, err = o.Raw(sql, pars).QueryRows(&items) return } // 获取文章封面 func CygxCygxArticleDataDetail(articleId int) (item *CygxArticleDataResp, err error) { o := orm.NewOrm() sql := `SELECT * FROM cygx_article_data WHERE article_id = ? LIMIT 1 ` err = o.Raw(sql, articleId).QueryRow(&item) return }