1234567891011121314151617181920212223242526272829303132333435363738394041 |
- package ppt_english
- import (
- "eta/eta_api/global"
- "eta/eta_api/utils"
- "time"
- )
- // ReportPptEnglishImg Ppt转报告的图片记录表
- type ReportPptEnglishImg struct {
- ReportPptImgId int `orm:"column(report_ppt_img_id);pk" gorm:"primaryKey" description:"自增id"`
- PptId int `description:"ppt的id"`
- ReportId int `description:"关联的报告ID"`
- ReportChapterId int `description:"关联的报告章节ID"`
- ImgUrl string `description:"ppt图片地址"`
- CreateTime time.Time `description:"创建时间"`
- }
- // AddAndEditMultiReportPptEnglishImg 批量添加Ppt转报告的图片记录
- func AddAndEditMultiReportPptEnglishImg(pptId int, reportPptEnglishImgList []*ReportPptEnglishImg) (err error) {
- if len(reportPptEnglishImgList) < 0 {
- return
- }
- o := global.DbMap[utils.DbNameReport]
- to := o.Begin()
- defer func() {
- if err != nil {
- _ = to.Rollback()
- } else {
- _ = to.Commit()
- }
- }()
- sql := ` DELETE FROM report_ppt_english_img WHERE ppt_id = ?`
- err = to.Exec(sql, pptId).Error
- if err != nil {
- return
- }
- err = to.CreateInBatches(reportPptEnglishImgList, utils.MultiAddNum).Error
- return
- }
|