|
@@ -131,7 +131,7 @@ func (m *SpeechRecognitionMenu) GetItemByCondition(condition string, pars []inte
|
|
|
}
|
|
|
sql := fmt.Sprintf(`SELECT * FROM %s WHERE 1=1 %s %s LIMIT 1`, m.TableName(), condition, order)
|
|
|
//err = o.Raw(sql, pars).QueryRow(&item)
|
|
|
- err = global.DEFAULT_DmSQL.Raw(sql, pars).First(&item).Error
|
|
|
+ err = global.DEFAULT_DmSQL.Raw(sql, pars...).First(&item).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -139,7 +139,7 @@ func (m *SpeechRecognitionMenu) GetCountByCondition(condition string, pars []int
|
|
|
// o := orm.NewOrm()
|
|
|
sql := fmt.Sprintf(`SELECT COUNT(1) FROM %s WHERE 1=1 %s`, m.TableName(), condition)
|
|
|
//err = o.Raw(sql, pars).QueryRow(&count)
|
|
|
- err = global.DEFAULT_DmSQL.Raw(sql, pars).Scan(&count).Error
|
|
|
+ err = global.DEFAULT_DmSQL.Raw(sql, pars...).Scan(&count).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -155,7 +155,7 @@ func (m *SpeechRecognitionMenu) GetItemsByCondition(condition string, pars []int
|
|
|
}
|
|
|
sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order)
|
|
|
//_, err = o.Raw(sql, pars).QueryRows(&items)
|
|
|
- err = global.DEFAULT_DmSQL.Raw(sql, pars).Find(&items).Error
|
|
|
+ err = global.DEFAULT_DmSQL.Raw(sql, pars...).Find(&items).Error
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -277,6 +277,6 @@ func (m *SpeechRecognitionMenu) UpdateChildByParentMenuId(menuIds []int, rootId
|
|
|
pars = append(pars, menuIds)
|
|
|
sql := fmt.Sprintf(`UPDATE %s SET %s = ?, %s = %s + ? WHERE %s IN (%s)`, m.TableName(), SpeechRecognitionMenuCols.RootId, SpeechRecognitionMenuCols.Level, SpeechRecognitionMenuCols.Level, SpeechRecognitionMenuCols.SpeechRecognitionMenuId, utils.GetOrmInReplace(len(menuIds)))
|
|
|
//_, err = o.Raw(sql, pars).Exec()
|
|
|
- err = global.DEFAULT_DmSQL.Exec(sql, pars).Error
|
|
|
+ err = global.DEFAULT_DmSQL.Exec(sql, pars...).Error
|
|
|
return
|
|
|
}
|