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