search.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "github.com/rdlucklib/rdluck_tools/paging"
  5. )
  6. type SearchItem struct {
  7. ArticleId int `description:"文章id"`
  8. Body []string `description:"搜索结果"`
  9. Title string `description:"标题"`
  10. PublishDate string `description:"发布时间"`
  11. ExpertBackground string `description:"专家背景"`
  12. ImgUrlPc string `description:"图片链接"`
  13. CategoryId string `description:"文章分类"`
  14. Source int `description:"来源 1:文章, 2:图表"`
  15. IsNeedJump bool `description:"是否需要跳转链接地址"`
  16. IsResearch bool `description:"是否属于研选"`
  17. Pv int `description:"Pv"`
  18. }
  19. type CategoryItem struct {
  20. CategoryName string
  21. }
  22. func GetCategoryByCompanyId(companyId int) (items []*CategoryItem, err error) {
  23. o := orm.NewOrm()
  24. sql := `SELECT b.chart_permission_id,d.category_name FROM company_product AS a
  25. INNER JOIN company_report_permission AS b ON a.company_id=b.company_id AND a.product_id=b.product_id
  26. INNER JOIN cygx_permission_mapping AS d ON b.chart_permission_id=d.chart_permission_id
  27. WHERE a.product_id=2
  28. AND a.company_id=?`
  29. _, err = o.Raw(sql, companyId).QueryRows(&items)
  30. return
  31. }
  32. type SearchResp struct {
  33. Paging *paging.PagingItem
  34. List []*SearchItem
  35. }