package models import ( "eta_gn/eta_api/global" "eta_gn/eta_api/utils" "time" ) // ReportPptImg Ppt转报告的图片记录表 type ReportPptImg struct { ReportPptImgId int `gorm:"column:report_ppt_img_id" json:"report_ppt_img_id"` //`orm:"column(report_ppt_img_id);pk;auto" description:"自增id"` PptId int `gorm:"column:ppt_id"` //`description:"ppt的id"` ReportId int `gorm:"column:report_id"` //`description:"关联的报告ID"` ReportChapterId int `gorm:"column:report_chapter_id"` //`description:"关联的报告章节ID"` ImgUrl string `gorm:"column:img_url"` // `description:"ppt图片地址"` CreateTime time.Time `gorm:"column:create_time"` //`description:"创建时间"` } // AddAndEditMultiReportPptImg 批量添加Ppt转报告的图片记录 func AddAndEditMultiReportPptImg(pptId int, reportPptImgList []*ReportPptImg) (err error) { if len(reportPptImgList) < 0 { return } to := global.DmSQL["rddp"].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 }