ppt_v2.go 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486
  1. package models
  2. import (
  3. "eta_gn/eta_api/global"
  4. "eta_gn/eta_api/utils"
  5. "fmt"
  6. "strings"
  7. "time"
  8. "github.com/rdlucklib/rdluck_tools/paging"
  9. )
  10. // PptV2 表
  11. type PptV2 struct {
  12. PptId int `gorm:"column:ppt_id;primaryKey;autoIncrement:true" description:"ppt的Id"`
  13. TemplateType int `gorm:"column:template_type" description:"模版类型"`
  14. BackgroundImg string `gorm:"column:background_img" description:"现在实际存的封面图(前端改动太大,不知道该字段之前谁定义的)"`
  15. Title string `gorm:"column:title" description:"标题"`
  16. ReportType string `gorm:"column:report_type" description:"报告类型"`
  17. PptDate string `gorm:"column:ppt_date" description:"选择日期"`
  18. Content string `gorm:"column:content" description:"ppt内容"`
  19. PptUrl string `gorm:"column:ppt_url" description:"ppt下载地址"`
  20. PptxUrl string `gorm:"column:pptx_url" description:"pptx下载地址"`
  21. CreateTime time.Time `gorm:"column:create_time" description:"创建时间"`
  22. ModifyTime time.Time `gorm:"column:modify_time" description:"修改时间"`
  23. AdminId int `gorm:"column:admin_id" description:"系统用户id"`
  24. AdminRealName string `gorm:"column:admin_real_name" description:"系统用户名称"`
  25. PptVersion int8 `gorm:"column:ppt_version" description:"是否ppt的旧版本;1:旧的,2:新的"`
  26. ReportId int `gorm:"column:report_id" description:"关联的报告ID"`
  27. ReportCode string `gorm:"column:report_code" description:"关联的报告code"`
  28. IsShare int8 `gorm:"column:is_share" description:"是否分享,0:不分享,1:分享"`
  29. PublishTime time.Time `gorm:"column:publish_time" description:"发布时间"`
  30. CoverContent string `gorm:"column:cover_content" description:"PPT内容-JSON"`
  31. PptPage int `gorm:"column:ppt_page" description:"PPT页数"`
  32. TitleSetting string `gorm:"column:title_setting" description:"PPT标题设置"`
  33. ClassifyId int `gorm:"column:classify_id" description:"报告分类ID"`
  34. AddType int `gorm:"column:add_type" description:"新增方式:1-新增报告;2-继承报告"`
  35. InheritReportId int `gorm:"column:inherit_report_id" description:"继承的报告ID"`
  36. CollaborateType int `gorm:"column:collaborate_type" description:"协作方式:1-个人;2-多人协作"`
  37. CollaborateUsers string `gorm:"column:collaborate_users" description:"协作人IDs, 英文逗号分隔"`
  38. IsPublicPublish int `gorm:"column:is_public_publish" description:"是否公开发布:1-是;2-否"`
  39. SubmitTime time.Time `gorm:"column:submit_time" description:"提交时间"`
  40. ApproveTime time.Time `gorm:"column:approve_time" description:"审批时间"`
  41. ReportSource int `gorm:"column:report_source" description:"报告来源:1-系统内;2-智力共享"`
  42. OutReportId string `gorm:"column:out_report_id" description:"外部报告ID(或编码)"`
  43. State int `gorm:"column:state" description:"报告状态:1-未发布;2-已发布;3-待提交;4-待审批;5-已驳回;6-已通过"`
  44. TopicEndTime time.Time `gorm:"column:topic_end_time" description:"课题结束时间"`
  45. CurrentBackgroundImg string `gorm:"column:current_background_img" description:"背景图片"`
  46. BackCoverImg string `gorm:"column:back_cover_img" description:"封底图片"`
  47. CurrentBackgroundImgId int `gorm:"column:current_background_img_id" description:"背景图片id"`
  48. BackCoverImgId int `gorm:"column:back_cover_img_id" description:"封底图片id"`
  49. BackgroundImgId int `gorm:"column:background_img_id" description:"封面图id"`
  50. }
  51. type PptV2Item struct {
  52. PptId int `gorm:"column:ppt_id;primaryKey" description:"ppt的Id"`
  53. TemplateType int `gorm:"column:template_type" description:"模版类型"`
  54. BackgroundImg string `gorm:"column:background_img" description:"背景图片"`
  55. Title string `gorm:"column:title" description:"标题"`
  56. ReportType string `gorm:"column:report_type" description:"报告类型"`
  57. PptDate string `gorm:"column:ppt_date" description:"选择日期"`
  58. Content string `gorm:"column:content" description:"ppt内容"`
  59. PptUrl string `gorm:"column:ppt_url" description:"ppt下载地址"`
  60. PptxUrl string `gorm:"column:pptx_url" description:"pptx下载地址"`
  61. CreateTime time.Time `gorm:"column:create_time" description:"创建时间"`
  62. ModifyTime time.Time `gorm:"column:modify_time" description:"修改时间"`
  63. AdminId int `gorm:"column:admin_id" description:"系统用户id"`
  64. AdminRealName string `gorm:"column:admin_real_name" description:"系统用户名称"`
  65. PptVersion int8 `gorm:"column:ppt_version" description:"是否ppt的旧版本;1:旧的,2:新的"`
  66. IsAuth bool `gorm:"column:is_auth" description:"true:有操作权限,false:无操作权限"`
  67. ReportId int `gorm:"column:report_id" description:"报告ID"`
  68. ReportCode string `gorm:"column:report_code" description:"关联的报告code"`
  69. IsShare int8 `gorm:"column:is_share" description:"是否分享,0:不分享,1:分享"`
  70. PublishTime time.Time `gorm:"column:publish_time" description:"发布时间"`
  71. CoverContent string `gorm:"column:cover_content" description:"PPT内容-JSON"`
  72. PptPage int `gorm:"column:ppt_page" description:"PPT页数"`
  73. TitleSetting string `gorm:"column:title_setting" description:"PPT标题设置"`
  74. }
  75. func GetPptV2List(condition string, pars []interface{}, startSize, pageSize int) (items []*PptV2Item, err error) {
  76. sql := `SELECT * FROM ppt_v2 WHERE 1=1 `
  77. if condition != "" {
  78. sql += condition
  79. }
  80. //
  81. sql += `ORDER BY modify_time DESC LIMIT ?,?`
  82. pars = append(pars, startSize)
  83. pars = append(pars, pageSize)
  84. err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&items).Error
  85. return
  86. }
  87. func GetPptV2ByCondition(condition string, pars []interface{}) (items []*PptV2, err error) {
  88. sql := `SELECT * FROM ppt_v2 WHERE 1=1 `
  89. if condition != "" {
  90. sql += condition
  91. }
  92. //
  93. sql += `ORDER BY modify_time DESC`
  94. err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&items).Error
  95. return
  96. }
  97. func GetPptV2ListCount(condition string, pars []interface{}) (count int, err error) {
  98. sql := `SELECT COUNT(1) AS count FROM ppt_v2 WHERE 1=1 `
  99. if condition != "" {
  100. sql += condition
  101. }
  102. err = global.DmSQL["rddp"].Raw(sql, pars...).Scan(&count).Error
  103. return
  104. }
  105. type PptV2ListResp struct {
  106. List []*PptV2Item
  107. Paging *paging.PagingItem `description:"分页数据"`
  108. }
  109. // AddPptV2 新增PPT
  110. func AddPptV2(item *PptV2) (lastId int64, err error) {
  111. err = global.DmSQL["rddp"].Create(item).Error
  112. lastId = int64(item.PptId)
  113. return
  114. }
  115. // DeletePptV2 删除ppt
  116. func DeletePptV2(pptId int) (err error) {
  117. sql := `DELETE FROM ppt_v2 WHERE ppt_id=? `
  118. err = global.DmSQL["rddp"].Exec(sql, pptId).Error
  119. return
  120. }
  121. type AddPptV2Req struct {
  122. PptId int64 `description:"ppt_id"`
  123. FirstPage struct {
  124. Title string `description:"标题"`
  125. ReportType string `description:"类型"`
  126. PptDate string `description:"日期"`
  127. ImgUrl string `description:"封面图片"`
  128. CurrentBackgroundImg string `description:"背景图片"`
  129. BackCoverImg string `description:"封底图片"`
  130. CurrentBackgroundImgId int `description:"背景图片id"`
  131. BackCoverImgId int `description:"封底图片id"`
  132. BackgroundImgId int `description:"封面图id"`
  133. BackIndex int `description:"背景图片下标"`
  134. TemplateType int `description:"模版id"`
  135. } `description:"首页"`
  136. Content string `description:"ppt的json数据"`
  137. GroupId int64 `description:"目录id"`
  138. CoverContent string `description:"封面图内容-JSON数据"`
  139. TitleSetting string `description:"PPT标题设置"`
  140. }
  141. type AddPptResp struct {
  142. PptId int64 `description:"PptId"`
  143. }
  144. // Update 更新ppt基础信息
  145. func (item *PptV2) Update(cols []string) (err error) {
  146. err = global.DmSQL["rddp"].Select(cols).Updates(item).Error
  147. return
  148. }
  149. type DeletePptV2Req struct {
  150. PptId int `description:"PptId" `
  151. }
  152. // SavePptV2PathReq 保存ppt的下载地址请求
  153. type SavePptV2PathReq struct {
  154. PptId int `description:"PptId" `
  155. PptxUrl string `description:"PptxUrl" `
  156. }
  157. func GetPptV2ById(pptId int) (item *PptV2, err error) {
  158. sql := `SELECT * FROM ppt_v2 WHERE 1=1 AND ppt_id=? `
  159. err = global.DmSQL["rddp"].Raw(sql, pptId).Find(&item).Error
  160. return
  161. }
  162. func GetPptV2ByIds(pptIds []int) (list []*PptV2, err error) {
  163. err = global.DmSQL["rddp"].Table("ppt_v2").Where("ppt_id IN ?", pptIds).Find(&list).Error
  164. return
  165. }
  166. // EditPptV2Path 编辑Ppt的下载地址
  167. func EditPptV2Path(pptId int, pptxPath string) (err error) {
  168. sql := `UPDATE ppt_v2 SET pptx_url=?,modify_time=NOW(),publish_time=NOW() WHERE ppt_id=? `
  169. err = global.DmSQL["rddp"].Exec(sql, pptxPath, pptId).Error
  170. return
  171. }
  172. // PptV2PublishRecord 发布记录表
  173. type PptV2PublishRecord struct {
  174. Id int `gorm:"primaryKey" `
  175. PptId int
  176. PptUrl string
  177. CreateTime time.Time
  178. }
  179. // AddPptV2PublishRecord 添加发布记录,主要是记录每次发布的时候,当前的ppt
  180. func AddPptV2PublishRecord(item *PptV2PublishRecord) (lastId int64, err error) {
  181. err = global.DmSQL["rddp"].Create(item).Error
  182. lastId = int64(item.Id)
  183. return
  184. }
  185. // PptV2SaveLog ppt记录表
  186. type PptV2SaveLog struct {
  187. Id int `gorm:"column:id;primaryKey;autoIncrement" description:"自增Id"`
  188. PptId int `gorm:"column:ppt_id" description:"ppt的Id"`
  189. TemplateType int `gorm:"column:template_type" description:"模版类型"`
  190. BackgroundImg string `gorm:"column:background_img" description:"背景图片"`
  191. Title string `gorm:"column:title" description:"标题"`
  192. ReportType string `gorm:"column:report_type" description:"报告类型"`
  193. PptDate string `gorm:"column:ppt_date" description:"选择日期"`
  194. Content string `gorm:"column:content" description:"ppt内容"`
  195. AdminId int `gorm:"column:admin_id" description:"系统用户id"`
  196. AdminRealName string `gorm:"column:admin_real_name" description:"系统用户名称"`
  197. CreateTime time.Time `gorm:"column:create_time" description:"创建时间"`
  198. CoverContent string `gorm:"column:cover_content" description:"PPT内容-JSON"`
  199. TitleSetting string `gorm:"column:title_setting" description:"PPT标题设置"`
  200. CurrentBackgroundImg string `gorm:"column:current_background_img" description:"背景图片"`
  201. BackCoverImg string `gorm:"column:back_cover_img" description:"封底图片"`
  202. }
  203. // AddPptV2SaveLog 新增PPT日志
  204. func AddPptV2SaveLog(item *PptV2SaveLog) (lastId int64, err error) {
  205. err = global.DmSQL["rddp"].Create(item).Error
  206. lastId = int64(item.Id)
  207. return
  208. }
  209. type PptV2ConfigResp struct {
  210. PptNum int `description:"ppt数量" json:"ppt_num"`
  211. ChartNum int `description:"图片数量" json:"chart_num"`
  212. }
  213. type PPT2ReportReq struct {
  214. PptId int `description:"PPT主键"`
  215. ClassifyId int `description:"报告二级分类ID"`
  216. Title string `description:"标题"`
  217. }
  218. // AddPptV2Multi 批量新增ppt
  219. func AddPptV2Multi(list []*PptV2) (err error) {
  220. err = global.DmSQL["rddp"].CreateInBatches(list, utils.MultiAddNum).Error
  221. return
  222. }
  223. // GetAllPptTitle 获取当前目录的所有名称
  224. func GetAllPptTitle() (names []string, err error) {
  225. sql := "select title from ppt_v2"
  226. err = global.DmSQL["rddp"].Raw(sql).Scan(&names).Error
  227. return
  228. }
  229. // PPT2ReportResp PPT转报告响应体
  230. type PPT2ReportResp struct {
  231. ReportId int `description:"关联的报告ID" json:"report_id"`
  232. ReportCode string `description:"关联的报告编码" json:"report_code"`
  233. }
  234. // GetPptV2ByReportId 通过关联的报告ID获取PPT
  235. func GetPptV2ByReportId(reportId int) (item *PptV2, err error) {
  236. sql := `SELECT * FROM ppt_v2 WHERE 1=1 AND report_id=? LIMIT 1`
  237. err = global.DmSQL["rddp"].Raw(sql, reportId).First(&item).Error
  238. return
  239. }
  240. // GetSharePptV2 获取公开分享的ppt
  241. func GetSharePptV2(IsNewPpt int) (items []*PptV2, err error) {
  242. sql := `SELECT * FROM ppt_v2 WHERE 1=1 AND is_share = 1 `
  243. if IsNewPpt > 0 {
  244. sql += ` AND ppt_version = 2 `
  245. }
  246. sql += `ORDER BY create_time DESC`
  247. err = global.DmSQL["rddp"].Raw(sql).Find(&items).Error
  248. return
  249. }
  250. // GetAllPptV2List 根据条件获取所有的Ppt
  251. func GetAllPptV2List(condition string, pars []interface{}) (items []*PptV2Item, err error) {
  252. sql := `SELECT * FROM ppt_v2 WHERE 1=1 `
  253. if condition != "" {
  254. sql += condition
  255. }
  256. //
  257. sql += `ORDER BY modify_time DESC `
  258. err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&items).Error
  259. return
  260. }
  261. type EnPPT2CnReq struct {
  262. PptId int `description:"英文PPT主键"`
  263. GroupId int `description:"目录ID"`
  264. }
  265. type BatchEnPPT2CnReq struct {
  266. PptIds string `description:"英文PPT主键s"`
  267. GroupId int `description:"目录ID"`
  268. }
  269. func GetPptV2ByTitleAndId(title string, adminId int) (item *PptV2, err error) {
  270. sql := `SELECT * FROM ppt_v2 WHERE 1=1 AND title=? AND admin_id=? `
  271. err = global.DmSQL["rddp"].Raw(sql, title, adminId).First(&item).Error
  272. return
  273. }
  274. // PPTEditingReq 标记编辑中请求体
  275. type PPTEditingReq struct {
  276. PptId int `description:"PPT主键ID"`
  277. Status int `description:"标记状态: 1-编辑中; 2-编辑完成"`
  278. }
  279. // PPTDetailResp PPT详情响应体
  280. type PPTDetailResp struct {
  281. *PptV2
  282. Editor PPTEditingCache `description:"编辑人信息"`
  283. HasAuth bool `description:"是否有权限"`
  284. }
  285. // PPTEditingCache PPT编辑缓存信息
  286. type PPTEditingCache struct {
  287. IsEditing bool `description:"是否有人编辑"`
  288. AdminId int `description:"编辑者ID"`
  289. Editor string `description:"编辑者姓名"`
  290. Tips string `description:"提示信息"`
  291. }
  292. func (m *PptV2) TableName() string {
  293. return "ppt_v2"
  294. }
  295. func (m *PptV2) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*PptV2, err error) {
  296. fields := strings.Join(fieldArr, ",")
  297. if len(fieldArr) == 0 {
  298. fields = `*`
  299. }
  300. order := `ORDER BY create_time DESC`
  301. if orderRule != "" {
  302. order = ` ORDER BY ` + orderRule
  303. }
  304. sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order)
  305. err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&items).Error
  306. return
  307. }
  308. func (m *PptV2) GetPageItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string, startSize, pageSize int) (items []*PptV2, err error) {
  309. fields := strings.Join(fieldArr, ",")
  310. if len(fieldArr) == 0 {
  311. fields = `*`
  312. }
  313. order := `ORDER BY create_time DESC`
  314. if orderRule != "" {
  315. order = ` ORDER BY ` + orderRule
  316. }
  317. sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s LIMIT ?,?`, fields, m.TableName(), condition, order)
  318. pars = append(pars, startSize, pageSize)
  319. err = global.DmSQL["rddp"].Raw(sql, pars...).Find(&items).Error
  320. return
  321. }
  322. func (m *PptV2) GetCountByCondition(condition string, pars []interface{}) (count int, err error) {
  323. sql := fmt.Sprintf(`SELECT COUNT(1) FROM %s WHERE 1=1 %s`, m.TableName(), condition)
  324. err = global.DmSQL["rddp"].Raw(sql, pars...).Scan(&count).Error
  325. return
  326. }
  327. // PptReportQueryFields 除富文本的常用查询字段
  328. var PptReportQueryFields = []string{
  329. "ppt_id", "title", "classify_id", "ppt_version", "pptx_url", "ppt_page", "title_setting", "state", "report_source", "publish_time", "submit_time", "approve_time", "create_time", "modify_time", "admin_id", "admin_real_name", "collaborate_type", "collaborate_users",
  330. }
  331. type PptReportItem struct {
  332. PptId int `description:"主键Id"`
  333. Title string `description:"标题"`
  334. ClassifyId int `description:"报告分类ID"`
  335. PptVersion int `description:"是否ppt的旧版本;1:旧的,2:新的"`
  336. PptxUrl string `description:"pptx下载地址"`
  337. PptPage int `description:"PPT总页数"`
  338. //Content string `description:"内容"`
  339. TitleSetting string `description:"PPT标题设置"`
  340. State int `description:"报告状态:1-未发布;2-已发布;3-待提交;4-待审批;5-已驳回;6-已通过"`
  341. ReportSource int `description:"报告来源:1-系统内;2-智力共享"`
  342. PublishTime string `description:"发布时间"`
  343. SubmitTime string `description:"提交时间"`
  344. ApproveTime string `description:"审批时间"`
  345. CreateTime string `description:"创建时间"`
  346. ModifyTime string `description:"更新时间"`
  347. FullClassify string `description:"分类完整路径, /分隔"`
  348. CollaborateType int `description:"协作方式:1-个人;2-多人协作"`
  349. CollaborateUsers []PptReportCollaborateUser `description:"协作人信息"`
  350. HasAuth bool `description:"是否创建人/协作人"`
  351. Editor PPTEditingCache `description:"编辑人信息"`
  352. AdminId int `description:"创建人ID"`
  353. AdminRealName string `description:"创建人姓名"`
  354. }
  355. type PptReportCollaborateUser struct {
  356. AdminId int `description:"用户ID"`
  357. RealName string `description:"用户姓名"`
  358. }
  359. func (m *PptV2) Format2ReportItem(origin *PptV2) (item *PptReportItem) {
  360. if origin == nil {
  361. return
  362. }
  363. item = new(PptReportItem)
  364. item.PptId = origin.PptId
  365. item.Title = origin.Title
  366. item.ClassifyId = origin.ClassifyId
  367. item.PptVersion = int(origin.PptVersion)
  368. item.PptxUrl = origin.PptxUrl
  369. item.PptPage = origin.PptPage
  370. //item.Content = origin.Content
  371. item.TitleSetting = origin.TitleSetting
  372. item.State = origin.State
  373. item.ReportSource = origin.ReportSource
  374. item.PublishTime = utils.TimeTransferString(utils.FormatDateTime, origin.PublishTime)
  375. item.SubmitTime = utils.TimeTransferString(utils.FormatDateTime, origin.SubmitTime)
  376. item.ApproveTime = utils.TimeTransferString(utils.FormatDateTime, origin.ApproveTime)
  377. item.CreateTime = utils.TimeTransferString(utils.FormatDateTime, origin.CreateTime)
  378. item.ModifyTime = utils.TimeTransferString(utils.FormatDateTime, origin.ModifyTime)
  379. item.AdminId = origin.AdminId
  380. item.AdminRealName = origin.AdminRealName
  381. item.CollaborateType = origin.CollaborateType
  382. return
  383. }
  384. type PptReportClassifyItem struct {
  385. Id int `description:"分类ID"`
  386. ClassifyName string `description:"分类名称"`
  387. Sort int `description:"排序"`
  388. ParentId int `description:"父级分类ID"`
  389. Enabled int `description:"是否可用,1可用,0禁用"`
  390. Level int `description:"层级"`
  391. HasChild int `description:"是否有子级别,0:下面没有子分类,1:下面有子分类;默认:0"`
  392. ClassifyType int `description:"分类类型:1-研报;2-PPT"`
  393. ReportNum int `description:"分类下的报告数"`
  394. PptList []*PptReportItem `description:"ppt报告"`
  395. Child []*PptReportClassifyItem `description:"子分类"`
  396. }
  397. type PptPageReportResp struct {
  398. List []*PptReportItem
  399. Paging *paging.PagingItem `description:"分页数据"`
  400. }
  401. type PptReportCreateReq struct {
  402. Title string `description:"标题"`
  403. ClassifyId int `description:"分类ID"`
  404. AddType int `description:"新增方式:1:新增报告,2:继承报告"`
  405. InheritPptId int `description:"待继承的报告ID"`
  406. CollaborateType int `description:"协作方式,1:个人,2:多人协作。默认:1"`
  407. CollaborateUserIds []int `description:"协作人IDs"`
  408. FirstPage struct {
  409. Title string `description:"标题"`
  410. ReportType string `description:"类型"`
  411. PptDate string `description:"日期"`
  412. ImgUrl string `description:"图片"`
  413. CurrentBackgroundImg string `description:"背景图片"`
  414. BackCoverImg string `description:"封底图片"`
  415. CurrentBackgroundImgId int `description:"背景图片id"`
  416. BackCoverImgId int `description:"封底图片id"`
  417. BackgroundImgId int `description:"封面图id"`
  418. BackIndex int `description:"背景图片下标"`
  419. TemplateType int `description:"模版id"`
  420. } `description:"首页"`
  421. Content string `description:"ppt的json数据"`
  422. CoverContent string `description:"封面图内容-JSON数据"`
  423. TitleSetting string `description:"PPT标题设置"`
  424. }
  425. // MovePptReportClassify 转移PPT报告分类
  426. func MovePptReportClassify(newClassifyId, originClassifyId int) (err error) {
  427. sql := `UPDATE ppt_v2 SET classify_id = ? WHERE classify_id = ?`
  428. err = global.DmSQL["rddp"].Exec(sql, newClassifyId, originClassifyId).Error
  429. return
  430. }
  431. // GetPptByImageIdCount 根据图片id查询ppt信息
  432. func GetPptByImageIdCount(imageId int) (count int, err error) {
  433. sql := `SELECT COUNT(1) FROM ppt_v2 WHERE current_background_img_id = ? or back_cover_img_id = ? or background_img_id = ?`
  434. err = global.DmSQL["rddp"].Raw(sql, imageId, imageId, imageId).Scan(&count).Error
  435. return
  436. }