package models import ( "github.com/beego/beego/v2/client/orm" "github.com/rdlucklib/rdluck_tools/paging" ) type SearchItem struct { ArticleId int `description:"文章id"` Body []string `description:"搜索结果"` Title string `description:"标题"` PublishDate string `description:"发布时间"` ExpertBackground string `description:"专家背景"` ImgUrlPc string `description:"图片链接"` CategoryId string `description:"文章分类"` Source int `description:"来源 1:文章, 2:图表"` IsNeedJump bool `description:"是否需要跳转链接地址"` IsResearch bool `description:"是否属于研选"` Pv int `description:"Pv"` } type CategoryItem struct { CategoryName string } func GetCategoryByCompanyId(companyId int) (items []*CategoryItem, err error) { o := orm.NewOrm() sql := `SELECT b.chart_permission_id,d.category_name FROM company_product AS a INNER JOIN company_report_permission AS b ON a.company_id=b.company_id AND a.product_id=b.product_id INNER JOIN cygx_permission_mapping AS d ON b.chart_permission_id=d.chart_permission_id WHERE a.product_id=2 AND a.company_id=?` _, err = o.Raw(sql, companyId).QueryRows(&items) return } type SearchResp struct { Paging *paging.PagingItem List []*SearchItem ChartList []*HomeChartListResp `description:"图表列表"` }