123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379 |
- package ppt_english
- import (
- "eta/eta_api/models/data_manage/excel"
- "time"
- "github.com/beego/beego/v2/client/orm"
- "github.com/rdlucklib/rdluck_tools/paging"
- )
- // PptEnglish 表
- type PptEnglish struct {
- PptId int `orm:"column(ppt_id);pk;auto" description:"ppt的Id"`
- TemplateType int `description:"模版类型"`
- BackgroundImg string `description:"背景图片"`
- Title string `description:"标题"`
- ReportType string `description:"报告类型"`
- PptDate string `description:"选择日期"`
- Content string `description:"ppt内容"`
- PptxUrl string `description:"pptx下载地址"`
- CreateTime time.Time `description:"创建时间"`
- ModifyTime time.Time `description:"修改时间"`
- AdminId int `description:"系统用户id"`
- AdminRealName string `description:"系统用户名称"`
- ReportId int `description:"关联的报告ID"`
- ReportCode string `description:"关联的报告code"`
- IsShare int8 `description:"是否分享,0:不分享,1:分享"`
- PublishTime time.Time `description:"发布时间"`
- CoverContent string `description:"PPT内容-JSON"`
- PptPage int `description:"PPT页数"`
- TitleSetting string `description:"PPT标题设置"`
- }
- type PptEnglishItem struct {
- PptId int `orm:"column(ppt_id);pk" description:"ppt的Id"`
- TemplateType int `description:"模版类型"`
- BackgroundImg string `description:"背景图片"`
- Title string `description:"标题"`
- ReportType string `description:"报告类型"`
- PptDate string `description:"选择日期"`
- Content string `description:"ppt内容"`
- PptxUrl string `description:"pptx下载地址"`
- CreateTime time.Time `description:"创建时间"`
- ModifyTime time.Time `description:"修改时间"`
- AdminId int `description:"系统用户id"`
- AdminRealName string `description:"系统用户名称"`
- IsAuth bool `description:"true:有操作权限,false:无操作权限"`
- ReportId int `description:"报告ID"`
- ReportCode string `description:"关联的报告code"`
- IsShare int8 `description:"是否分享,0:不分享,1:分享"`
- PublishTime time.Time `description:"发布时间"`
- CoverContent string `description:"PPT内容-JSON"`
- PptPage int `description:"PPT页数"`
- TitleSetting string `description:"PPT标题设置"`
- }
- func GetPptEnglishList(condition string, pars []interface{}, startSize, pageSize int) (items []*PptEnglishItem, err error) {
- o := orm.NewOrmUsingDB("rddp")
- sql := `SELECT * FROM ppt_english WHERE 1=1 `
- if condition != "" {
- sql += condition
- }
- //
- sql += `ORDER BY modify_time DESC LIMIT ?,?`
- //sql += `ORDER BY create_time DESC LIMIT ?,?`
- _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
- return
- }
- func GetPptEnglishByCondition(condition string, pars []interface{}) (items []*PptEnglish, err error) {
- o := orm.NewOrmUsingDB("rddp")
- sql := `SELECT * FROM ppt_english WHERE 1=1 `
- if condition != "" {
- sql += condition
- }
- //
- sql += `ORDER BY modify_time DESC`
- //sql += `ORDER BY create_time DESC LIMIT ?,?`
- _, err = o.Raw(sql, pars).QueryRows(&items)
- return
- }
- func GetPptEnglishListCount(condition string, pars []interface{}) (count int, err error) {
- o := orm.NewOrmUsingDB("rddp")
- sql := `SELECT COUNT(1) AS count FROM ppt_english WHERE 1=1 `
- if condition != "" {
- sql += condition
- }
- err = o.Raw(sql, pars).QueryRow(&count)
- return
- }
- type PptEnglishListResp struct {
- List []*PptEnglishItem
- Paging *paging.PagingItem `description:"分页数据"`
- }
- // AddPptEnglish 新增PPT
- func AddPptEnglish(item *PptEnglish) (lastId int64, err error) {
- o := orm.NewOrmUsingDB("rddp")
- lastId, err = o.Insert(item)
- return
- }
- // DeletePptEnglish 删除ppt
- func DeletePptEnglish(pptId int) (err error) {
- o := orm.NewOrmUsingDB("rddp")
- sql := `DELETE FROM ppt_english WHERE ppt_id=? `
- _, err = o.Raw(sql, pptId).Exec()
- return
- }
- type AddPptEnglishReq struct {
- PptId int64 `description:"ppt_id"`
- FirstPage struct {
- Title string `description:"标题"`
- ReportType string `description:"类型"`
- PptDate string `description:"日期"`
- ImgUrl string `description:"图片"`
- BackIndex int `description:"背景图片下标"`
- TemplateType int `description:"模版id"`
- } `description:"首页"`
- Content string `description:"ppt的json数据"`
- GroupId int64 `description:"目录id"`
- CoverContent string `description:"PPT内容-JSON"`
- TitleSetting string `description:"PPT标题设置"`
- ExcelReferences []excel.ExcelReferencesReq `description:"引用的Excel信息"`
- }
- type AddPptEnglishResp struct {
- PptId int64 `description:"PptId"`
- }
- type ContentPageItems struct {
- PptId int64 `json:"PptId" description:"ppt_id" `
- PptPagesId int `json:"PptPagesId" description:"章节id,新增时传0"`
- Title string `json:"Title" description:"标题"`
- ResourceId string `json:"ResourceId" description:"来源id,来自上海策略组提供的图表id"`
- Timestamp int `description:"时间戳"`
- }
- type EditPptEnglishReq struct {
- PptId int64 `description:"pptId"`
- FirstPage struct {
- PptPagesId int `description:"ppt_page_id"`
- Title string `description:"标题"`
- ReportType string `description:"类型"`
- PptDate string `description:"日期"`
- ImgUrl string `description:"图片路径"`
- BackIndex int `description:"背景图片下标"`
- }
- ContentPage []ContentPageItems
- }
- // Update 更新ppt基础信息
- func (item *PptEnglish) Update(cols []string) (err error) {
- o := orm.NewOrmUsingDB("rddp")
- _, err = o.Update(item, cols...)
- return
- }
- // EditPptEnglish 编辑ppt
- func EditPptEnglish(item *PptEnglish) (err error) {
- o := orm.NewOrmUsingDB("rddp")
- sql := `UPDATE ppt_english SET title = ?,ppt_date= ?, report_type=?,modify_time=NOW() WHERE ppt_id = ? `
- _, err = o.Raw(sql, item.Title, item.PptDate, item.ReportType, item.PptId).Exec()
- return
- }
- type DeletePptEnglishReq struct {
- PptId int `description:"PptId" `
- }
- // SavePptEnglishPathReq 保存ppt的下载地址请求
- type SavePptEnglishPathReq struct {
- PptId int `description:"PptId" `
- PptxUrl string `description:"PptxUrl" `
- }
- func GetPptEnglishById(pptId int) (item *PptEnglish, err error) {
- o := orm.NewOrmUsingDB("rddp")
- sql := `SELECT * FROM ppt_english WHERE 1=1 AND ppt_id=? `
- err = o.Raw(sql, pptId).QueryRow(&item)
- return
- }
- func GetPptEnglishByIds(pptIds []int) (list []*PptEnglish, err error) {
- _, err = orm.NewOrmUsingDB("rddp").
- QueryTable("ppt_english").
- Filter("ppt_id__in", pptIds).
- All(&list)
- return
- }
- func GetPptEnglishByTitle(title string) (item *PptEnglish, err error) {
- o := orm.NewOrmUsingDB("rddp")
- sql := `SELECT * FROM ppt_english WHERE 1=1 AND title=? `
- err = o.Raw(sql, title).QueryRow(&item)
- return
- }
- type PptPages struct {
- PptPagesId int `orm:"column(ppt_pages_id);pk" description:"报告章节Id"`
- PptId int64 `description:"ppt_id"`
- Title string `description:"标题"`
- ImgUrl string `description:"图片路径"`
- CreateTime time.Time `description:"创建时间"`
- ModifyTime time.Time `description:"修改时间"`
- PageCode string `description:"编码"`
- Width int `description:"宽度"`
- Height int `description:"高端"`
- ResourceId string `description:"来源id,来自上海策略组提供的图表id"`
- Timestamp int `description:"时间戳"`
- BackIndex int `description:"背景图片下标"`
- }
- type PptEnglishDetailResp struct {
- PptPages []*PptPages `description:"ppt详情数据"`
- Ppt *PptEnglish `description:"ppt数据"`
- }
- type PptEnglishPublishReq struct {
- PptId int `description:"PptId"`
- ScreenHeight int `description:"屏幕宽高"`
- }
- // EditPptEnglishPath 编辑Ppt的下载地址
- func EditPptEnglishPath(pptId int, pptxPath string) (err error) {
- sql := `UPDATE ppt_english SET pptx_url=?,modify_time=NOW(),publish_time=NOW() WHERE ppt_id=? `
- o := orm.NewOrmUsingDB("rddp")
- _, err = o.Raw(sql, pptxPath, pptId).Exec()
- return
- }
- // AddPptEnglishPublishRecord 发布记录表
- type PptEnglishPublishRecord struct {
- Id int `orm:"column(id);pk"`
- PptId int
- PptUrl string
- CreateTime time.Time
- }
- // AddPptEnglishPublishRecord 添加发布记录,主要是记录每次发布的时候,当前的ppt
- func AddPptEnglishPublishRecord(item *PptEnglishPublishRecord) (lastId int64, err error) {
- o := orm.NewOrmUsingDB("rddp")
- lastId, err = o.Insert(item)
- return
- }
- // PptEnglishSaveLog ppt记录表
- type PptEnglishSaveLog struct {
- Id int `orm:"column(id);pk" description:"自增Id"`
- PptId int `orm:"column(ppt_id)" description:"ppt的Id"`
- TemplateType int `description:"模版类型"`
- BackgroundImg string `description:"背景图片"`
- Title string `description:"标题"`
- ReportType string `description:"报告类型"`
- PptDate string `description:"选择日期"`
- Content string `description:"ppt内容"`
- AdminId int `description:"系统用户id"`
- AdminRealName string `description:"系统用户名称"`
- CreateTime time.Time `description:"创建时间"`
- CoverContent string `description:"PPT内容-JSON"`
- TitleSetting string `description:"PPT标题设置"`
- }
- // AddPptEnglishSaveLog 新增PPT日志
- func AddPptEnglishSaveLog(item *PptEnglishSaveLog) (lastId int64, err error) {
- o := orm.NewOrmUsingDB("rddp")
- lastId, err = o.Insert(item)
- return
- }
- type PptEnglishConfigResp struct {
- PptNum int `description:"ppt数量" json:"ppt_num"`
- ChartNum int `description:"图片数量" json:"chart_num"`
- }
- type PPT2ReportReq struct {
- PptId int `description:"PPT主键"`
- ClassifyIdSecond int `description:"报告二级分类ID"`
- Title string `description:"标题"`
- }
- // AddPptEnglishMulti 批量新增ppt
- func AddPptEnglishMulti(list []*PptEnglish) (err error) {
- o := orm.NewOrmUsingDB("rddp")
- _, err = o.InsertMulti(1, list)
- return
- }
- // GetAllPptTitle 获取当前目录的所有名称
- func GetAllPptTitle() (names []string, err error) {
- o := orm.NewOrmUsingDB("rddp")
- sql := "select title from ppt_english"
- _, err = o.Raw(sql).QueryRows(&names)
- return
- }
- // PPT2ReportResp PPT转报告响应体
- type PPT2ReportResp struct {
- ReportId int `description:"关联的报告ID" json:"report_id"`
- ReportCode string `description:"关联的报告编码" json:"report_code"`
- }
- // GetPptEnglishByReportId 通过关联的报告ID获取PPT
- func GetPptEnglishByReportId(reportId int) (item *PptEnglish, err error) {
- o := orm.NewOrmUsingDB("rddp")
- sql := `SELECT * FROM ppt_english WHERE 1=1 AND report_id=? LIMIT 1`
- err = o.Raw(sql, reportId).QueryRow(&item)
- return
- }
- // GetSharePptEnglish 获取公开分享的ppt
- func GetSharePptEnglish() (items []*PptEnglish, err error) {
- o := orm.NewOrmUsingDB("rddp")
- sql := `SELECT * FROM ppt_english WHERE 1=1 AND is_share = 1 ORDER BY create_time DESC `
- _, err = o.Raw(sql).QueryRows(&items)
- return
- }
- // GetAllPptEnglishList 根据条件获取所有的Ppt
- func GetAllPptEnglishList(condition string, pars []interface{}) (items []*PptEnglishItem, err error) {
- o := orm.NewOrmUsingDB("rddp")
- sql := `SELECT * FROM ppt_english WHERE 1=1 `
- if condition != "" {
- sql += condition
- }
- //
- sql += `ORDER BY modify_time DESC `
- _, err = o.Raw(sql, pars).QueryRows(&items)
- return
- }
- // GetSyncReportPptList 获取所有已经同步了报告的ppt
- func GetSyncReportPptList() (list []*PptEnglish, err error) {
- sql := `SELECT * FROM ppt_english WHERE report_id>0 `
- o := orm.NewOrmUsingDB("rddp")
- _, err = o.Raw(sql).QueryRows(&list)
- return
- }
- // GetPPTTitleList 获取PPT标题列表
- func GetPPTTitleList() (list []string, err error) {
- o := orm.NewOrmUsingDB("rddp")
- sql := `SELECT title FROM ppt_english`
- _, err = o.Raw(sql).QueryRows(&list)
- return
- }
- // EnglishPPT2ReportReq 英文PPT转报告请求体
- type EnglishPPT2ReportReq struct {
- PptId int `description:"PPT主键"`
- ClassifyIdFirst int `description:"一级分类ID"`
- ClassifyIdSecond int `description:"二级分类ID"`
- Title string `description:"标题"`
- Abstract string `description:"摘要"`
- }
- func GetPptEnglishByTitleAndId(title string, adminId int) (item *PptEnglish, err error) {
- o := orm.NewOrmUsingDB("rddp")
- sql := `SELECT * FROM ppt_english WHERE 1=1 AND title=? AND admin_id=? `
- err = o.Raw(sql, title, adminId).QueryRow(&item)
- return
- }
- // PPTEditingCache PPT编辑缓存信息
- type PPTEditingCache struct {
- IsEditing bool `description:"是否有人编辑"`
- AdminId int `description:"编辑者ID"`
- Editor string `description:"编辑者姓名"`
- Tips string `description:"提示信息"`
- }
- // EnglishPPTDetailResp 英文PPT详情响应体
- type EnglishPPTDetailResp struct {
- *PptEnglish
- Editor PPTEditingCache `description:"编辑人信息"`
- }
|