package models import ( "github.com/beego/beego/v2/client/orm" "time" ) type CygxReportSelectionLog struct { ArticleSunId int `description:"子级报告id"` ArticleId int `description:"父级报告Id"` ChartPermissionId int `description:"行业ID"` PermissionName string `description:"行业ID"` CreateTime time.Time `description:"创建时间"` Body string `description:"内容"` IndustrialSubjectId int `description:"标的ID"` IndustrialManagementId string `description:"产业资源包Id 多个用 , 隔开"` SubjectName string `description:"标的名称"` IcoLink string `orm:"column(image_url)"description:"图标链接"` CompanyLabel []string `description:"公司标签"` Label string `description:"公司标签"` OverviewArticleId int `description:"综述报告Id"` } type CygxReportSelectionLogResp struct { ArticleSunId int `description:"子级报告id"` ArticleId int `description:"父级报告Id"` ChartPermissionId int `description:"行业ID"` PermissionName string `description:"行业ID"` CreateTime time.Time `description:"创建时间"` Body string `description:"内容"` IndustrialSubjectId int `description:"标的ID"` IndustrialManagementId string `description:"产业资源包Id 多个用 , 隔开"` SubjectName string `description:"标的名称"` IcoLink string `orm:"column(image_url)"description:"图标链接"` CompanyLabel []string `description:"公司标签"` Label string `description:"公司标签"` OverviewArticleId int `description:"综述报告Id"` } // 列表 func GetCygxReportSelectionLog(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxReportSelectionLog, err error) { o := orm.NewOrm() sql := `SELECT * FROM cygx_report_selection_log as art WHERE 1= 1 ` if condition != "" { sql += condition } sql += ` LIMIT ?,? ` _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items) return } // 通过ID获取详情 func GetCygxReportSelectionLogDetail(articleId int, subjectName string) (item *CygxReportSelectionLogResp, err error) { o := orm.NewOrm() sql := `SELECT * FROM cygx_report_selection_log WHERE article_id=? AND subject_name = ? LIMIT 1 ` err = o.Raw(sql, articleId, subjectName).QueryRow(&item) return }