Pārlūkot izejas kodu

update

add_mode
DengBiao pirms 1 gada
vecāks
revīzija
b6c259bc55
1 mainītis faili ar 3 papildinājumiem un 2 dzēšanām
  1. +3
    -2
      app/admin/hdl/hdl_device.go

+ 3
- 2
app/admin/hdl/hdl_device.go Parādīt failu

@@ -26,7 +26,7 @@ func DeviceList(c *gin.Context) {
req.Page = 10
}

sess := db.Db.Desc("id")
sess := db.Db.Desc("device.id")
if req.Name != "" {
sess.And("device.name like ?", "%"+req.Name+"%")
}
@@ -40,7 +40,8 @@ func DeviceList(c *gin.Context) {
sess.And("device.create_at <=?", req.EndDate)
}
var m []*db.DeviceWithEnterprise
total, err := sess.Limit(req.Limit, (req.Page-1)*req.Limit).FindAndCount(&m)
total, err := sess.
Join("LEFT", "enterprise", "enterprise.id = device.enterprise_id").Limit(req.Limit, (req.Page-1)*req.Limit).FindAndCount(&m)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return


Notiek ielāde…
Atcelt
Saglabāt