| | |
| | | |
| | | type ( |
| | | Procedures struct { |
| | | gorm.Model `json:"-"` |
| | | gorm.Model |
| | | WorkOrderID string `gorm:"index;type:varchar(191);not null" json:"-"` |
| | | OrderID string `gorm:"index;type:varchar(191);not null" json:"-"` |
| | | DeviceID string `gorm:"index;type:varchar(191)" json:"deviceId"` |
| | |
| | | // CreateBatch 批量插入 |
| | | func (slf *ProceduresSearch) CreateBatch(records []*Procedures) error { |
| | | var db = slf.build() |
| | | |
| | | if err := db.Create(&records).Error; err != nil { |
| | | return fmt.Errorf("create batch err: %v, records: %+v", err, records) |
| | | for _, record := range records { |
| | | if err := db.Create(record).Error; err != nil { |
| | | return fmt.Errorf("create batch err: %v, records: %+v", err, records) |
| | | } |
| | | } |
| | | |
| | | return nil |
| | | } |
| | | |