liuxiulin 6 月之前
父节点
当前提交
89a20a3d3d
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      services/knowoapi/model/device.go

+ 2 - 0
services/knowoapi/model/device.go

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