|
@@ -139,6 +139,7 @@ func (a *Device) GetDevices(vendorid, proid string, pi, ps int, deviceid string)
|
|
if deviceid != "" {
|
|
if deviceid != "" {
|
|
tx = tx.Where("device_identifier like ?", "%"+deviceid+"%")
|
|
tx = tx.Where("device_identifier like ?", "%"+deviceid+"%")
|
|
}
|
|
}
|
|
|
|
+ tx = tx.Order("id DESC")
|
|
err = tx.Limit(ps).Offset((pi - 1) * ps).Find(&datas).Error
|
|
err = tx.Limit(ps).Offset((pi - 1) * ps).Find(&datas).Error
|
|
tx.Model(&models.Device{}).Count(&total)
|
|
tx.Model(&models.Device{}).Count(&total)
|
|
return
|
|
return
|
|
@@ -159,6 +160,7 @@ func (a *Device) Query(vendorId, productId string, deviceIDs []string) (datas []
|
|
if len(deviceIDs) > 0 {
|
|
if len(deviceIDs) > 0 {
|
|
tx = tx.Where("record_id in (?)", deviceIDs)
|
|
tx = tx.Where("record_id in (?)", deviceIDs)
|
|
}
|
|
}
|
|
|
|
+ tx = tx.Order("id DESC")
|
|
err = tx.Find(&datas).Error
|
|
err = tx.Find(&datas).Error
|
|
|
|
|
|
return
|
|
return
|