zhangqian
2023-10-08 d4243f398b84a8b8cdcd27c35ace72f6a30a6452
model/procedures.go
@@ -140,6 +140,11 @@
   return slf
}
func (slf *ProceduresSearch) SetChannel(channel int32) *ProceduresSearch {
   slf.Channel = channel
   return slf
}
func (slf *ProceduresSearch) build() *gorm.DB {
   var db = slf.Orm.Model(&Procedures{})
@@ -218,7 +223,10 @@
func (slf *ProceduresSearch) Upsert(record *Procedures) error {
   var db = slf.build()
   old, err := slf.First()
   if err != gorm.ErrRecordNotFound && old.ID != 0 {
      record.ID = old.ID
   }
   if err := db.Clauses(clause.OnConflict{
      UpdateAll: true,
   }).Create(&record).Error; err != nil {