123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- package models
- import (
- "eta_gn/eta_task/global"
- "time"
- )
- // ReportChapter 报告章节
- type ReportChapter struct {
- ReportChapterId int `gorm:"column:report_chapter_id;primaryKey"` // `orm:"column(report_chapter_id);pk" description:"报告章节ID"`
- ReportId int `description:"报告ID"`
- ReportType string `description:"报告类型 day-晨报 week-周报"`
- ClassifyIdFirst int `description:"一级分类id"`
- ClassifyNameFirst string `description:"一级分类名称"`
- TypeId int `description:"品种ID"`
- TypeName string `description:"品种名称"`
- Title string `description:"标题"`
- Abstract string `description:"摘要"`
- AddType int `description:"新增方式:1:新增报告,2:继承报告"`
- Author string `description:"作者"`
- Content string `description:"内容"`
- ContentSub string `description:"内容前两个章节"`
- Stage int `description:"期数"`
- Trend string `description:"趋势观点"`
- Sort int `description:"排序: 数值越小越靠前"`
- IsEdit int `description:"是否已编辑 0-待编辑 1-已编辑"`
- PublishState int `description:"发布状态 1-待发布,2-已发布"`
- PublishTime time.Time `description:"发布时间"`
- VideoUrl string `description:"音频文件URL"`
- VideoName string `description:"音频文件名称"`
- VideoPlaySeconds string `description:"音频播放时长"`
- VideoSize string `description:"音频文件大小,单位M"`
- VideoKind int `description:"音频生成方式:1,手动上传,2:自动生成"`
- CreateTime string `description:"创建时间"`
- ModifyTime time.Time `description:"修改时间"`
- OriginalVideoUrl string `description:"原始音频文件URL"`
- }
- // GetPublishedChapterListByReportId 根据ReportId获取已发布章节列表
- func GetPublishedChapterListByReportId(reportId int) (list []*ReportChapter, err error) {
- //o := orm.NewOrmUsingDB("rddp")
- //sql := ` SELECT * FROM report_chapter WHERE report_id = ? AND publish_state = 2 ORDER BY sort ASC`
- //_, err = o.Raw(sql, reportId).QueryRows(&list)
- sql := ` SELECT * FROM report_chapter WHERE report_id = ? AND publish_state = 2 ORDER BY sort ASC`
- err = global.DmSQL["rddp"].Raw(sql, reportId).Find(&list).Error
- return
- }
- // GetChapterListByReportId 根据ReportId获取章节列表
- func GetChapterListByReportId(reportId int) (list []*ReportChapter, err error) {
- //o := orm.NewOrmUsingDB("rddp")
- //sql := ` SELECT * FROM report_chapter WHERE report_id = ? ORDER BY sort ASC`
- //_, err = o.Raw(sql, reportId).QueryRows(&list)
- sql := ` SELECT * FROM report_chapter WHERE report_id = ? ORDER BY sort ASC`
- err = global.DmSQL["rddp"].Raw(sql, reportId).Find(&list).Error
- return
- }
- //// GetChapterListByChapterIds 根据ReportId获取章节列表
- //func GetChapterListByChapterIds(chapterIds []int) (list []*ReportChapter, err error) {
- // if len(chapterIds) == 0 {
- // return
- // }
- // o := orm.NewOrmUsingDB("rddp")
- // sql := ` SELECT * FROM report_chapter WHERE report_chapter_id IN (` + utils.GetOrmInReplace(len(chapterIds)) + `) ORDER BY sort ASC`
- // _, err = o.Raw(sql, chapterIds).QueryRows(&list)
- // return
- //}
- // UpdateChapter 更新报表章节
- func (chapterChapterInfo *ReportChapter) UpdateChapter(cols []string) (err error) {
- //o := orm.NewOrmUsingDB("rddp")
- //_, err = o.Update(chapterChapterInfo, cols...)
- err = global.DmSQL["rddp"].Select(cols).Updates(chapterChapterInfo).Error
- return
- }
|