feat: 植物识别百科ai助手迁移
This commit is contained in:
@@ -18,7 +18,10 @@ type BaseModel struct {
|
||||
|
||||
// BeforeCreate 创建前自动生成雪花ID
|
||||
func (m *BaseModel) BeforeCreate(db *gorm.DB) (err error) {
|
||||
db.Statement.SetColumn("id", uniqueid.GenerateID())
|
||||
if m.ID == "" {
|
||||
m.ID = uniqueid.GenerateID()
|
||||
}
|
||||
db.Statement.SetColumn("id", m.ID)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user