package models import ( "eta_gn/eta_report/global" "time" ) // ReportChapter 报告章节 type ReportChapter struct { ReportChapterId int `gorm:"primaryKey;autoIncrement;column:reportChapterId"` ReportId int `gorm:"column:report_id" description:"报告ID"` ReportType string `gorm:"column:report_type" description:"报告类型 day-晨报 week-周报"` ClassifyIdFirst int `gorm:"column:classify_id_first" description:"一级分类id"` ClassifyNameFirst string `gorm:"column:classify_name_first" description:"一级分类名称"` TypeId int `gorm:"column:type_id" description:"品种ID"` TypeName string `gorm:"column:type_name" description:"品种名称"` Title string `gorm:"column:title" description:"标题"` Abstract string `gorm:"column:abstract" description:"摘要"` AddType int `gorm:"column:add_type" description:"新增方式:1:新增报告,2:继承报告"` Author string `gorm:"column:author" description:"作者"` Content string `gorm:"column:content" description:"内容"` ContentSub string `gorm:"column:content_sub" description:"内容前两个章节"` Stage int `gorm:"column:stage" description:"期数"` Trend string `gorm:"column:trend" description:"趋势观点"` Sort int `gorm:"column:sort" description:"排序: 数值越小越靠前"` IsEdit int `gorm:"column:is_edit" description:"是否已编辑 0-待编辑 1-已编辑"` PublishState int `gorm:"column:publish_state" description:"发布状态 1-待发布,2-已发布"` PublishTime time.Time `gorm:"column:publish_time" description:"发布时间"` VideoUrl string `gorm:"column:video_url" description:"音频文件URL"` VideoName string `gorm:"column:video_name" description:"音频文件名称"` VideoPlaySeconds string `gorm:"column:video_play_seconds" description:"音频播放时长"` VideoSize string `gorm:"column:video_size" description:"音频文件大小,单位M"` VideoKind int `gorm:"column:video_kind" description:"音频生成方式:1,手动上传,2:自动生成"` CreateTime string `gorm:"column:create_time" description:"创建时间"` ModifyTime time.Time `gorm:"column:modify_time" description:"修改时间"` OriginalVideoUrl string `gorm:"column:original_video_url" description:"原始音频文件URL"` } // GetPublishedChapterListByReportId 根据ReportId获取已发布章节列表 func GetPublishedChapterListByReportId(reportId int) (list []*ReportChapter, err error) { sql := ` SELECT * FROM report_chapter WHERE report_id = ? AND publish_state = 2 ORDER BY sort ASC` err = global.DEFAULT_DmSQL.Raw(sql, reportId).Find(&list).Error return }