package ppt_english import ( "github.com/beego/beego/v2/client/orm" "time" ) // ReportPptEnglishImg Ppt转报告的图片记录表 type ReportPptEnglishImg struct { ReportPptImgId int `orm:"column(report_ppt_img_id);pk;auto" 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 := orm.NewOrmUsingDB("rddp") to, err := o.Begin() if err != nil { return } defer func() { if err != nil { _ = to.Rollback() } else { _ = to.Commit() } }() sql := ` DELETE FROM report_ppt_english_img WHERE ppt_id = ?` _, err = to.Raw(sql, pptId).Exec() if err != nil { return } _, err = to.InsertMulti(len(reportPptEnglishImgList), reportPptEnglishImgList) return }