|
@@ -304,10 +304,10 @@ func toCloudDiskResourceList(items []*CloudDiskResource) (resourceList []*CloudD
|
|
|
return
|
|
|
}
|
|
|
func GetCloudDiskResourceList(resourceCond string, resourcePars []interface{}) (resourceList []*CloudDiskResourcePageItem, err error) {
|
|
|
- o := orm.NewOrm()
|
|
|
+ //o := orm.NewOrm()
|
|
|
sql := fmt.Sprintf(`SELECT resource_id , resource_name, resource_suffix, menu_id, size, admin_name, create_time FROM cloud_disk_resource WHERE 1=1 %s `, resourceCond)
|
|
|
var ormList []*CloudDiskResource
|
|
|
- _, err = o.Raw(sql, resourcePars).QueryRows(&ormList)
|
|
|
+ err = global.DEFAULT_DB.Raw(sql, resourcePars).Find(&ormList).Error
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
@@ -320,8 +320,7 @@ func BatchMoveCloudDiskResource(menuId int, resourceIds []int) (err error) {
|
|
|
if resourceLens == 0 {
|
|
|
return
|
|
|
}
|
|
|
- o := orm.NewOrm()
|
|
|
sql := `UPDATE cloud_disk_resource SET menu_id = ? WHERE resource_id IN (` + utils.GetOrmInReplace(resourceLens) + `)`
|
|
|
- _, err = o.Raw(sql, menuId, resourceIds).Exec()
|
|
|
+ err = global.DEFAULT_DB.Exec(sql, menuId, resourceIds).Error
|
|
|
return
|
|
|
}
|