|
@@ -1,11 +1,11 @@
|
|
|
package models
|
|
|
|
|
|
import (
|
|
|
+ "eta/eta_api/global"
|
|
|
"eta/eta_api/utils"
|
|
|
"fmt"
|
|
|
"github.com/beego/beego/v2/client/orm"
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
- "eta/eta_api/global"
|
|
|
"gorm.io/gorm"
|
|
|
"strings"
|
|
|
"time"
|
|
@@ -241,16 +241,15 @@ func BatchDeleteCloudDiskMenuAndResource(menuIds, resourceIds []int) (err error)
|
|
|
}
|
|
|
|
|
|
func GetCloudDiskResourcePageCount(resourceCond string, resourcePars []interface{}) (total int, err error) {
|
|
|
- o := orm.NewOrm()
|
|
|
sql := fmt.Sprintf(`SELECT COUNT(1) FROM cloud_disk_resource WHERE 1=1 %s `, resourceCond)
|
|
|
- err = o.Raw(sql, resourcePars).QueryRow(&total)
|
|
|
+ err = global.DEFAULT_DB.Raw(sql, resourcePars...).Scan(&total).Error
|
|
|
return
|
|
|
}
|
|
|
func GetCloudDiskResourcePageList(resourceCond string, resourcePars []interface{}, orderRule string, startSize, pageSize int, menuNameMap map[int]string) (resourceList []*CloudDiskResourcePageItem, err error) {
|
|
|
- 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 order by %s LIMIT ?,?`, resourceCond, orderRule)
|
|
|
var ormList []*CloudDiskResource
|
|
|
- _, err = o.Raw(sql, resourcePars, startSize, pageSize).QueryRows(&ormList)
|
|
|
+ resourcePars = append(resourcePars, startSize, pageSize)
|
|
|
+ err = global.DEFAULT_DB.Raw(sql, resourcePars...).Find(&ormList).Error
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|