|
@@ -539,7 +539,7 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta |
|
|
|
|
|
|
|
|
//查询出所有的设备 |
|
|
//查询出所有的设备 |
|
|
var deviceList []*model.Device |
|
|
var deviceList []*model.Device |
|
|
if req.EnterpriseId != 0 { |
|
|
|
|
|
|
|
|
if req.EnterpriseId == 0 { |
|
|
err := db.Db.Where("enterprise_id != 0").Find(&deviceList) |
|
|
err := db.Db.Where("enterprise_id != 0").Find(&deviceList) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
logx.Error(err) |
|
|
logx.Error(err) |
|
@@ -576,7 +576,7 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta |
|
|
for _, v := range deviceList { |
|
|
for _, v := range deviceList { |
|
|
deviceListMapping[v.DeviceSn] = *v |
|
|
deviceListMapping[v.DeviceSn] = *v |
|
|
var m []*db.SelfSupportForSchoolOrdWithUserIdentityV2 |
|
|
var m []*db.SelfSupportForSchoolOrdWithUserIdentityV2 |
|
|
sess := db.Db.Where("device_sn = ?", v.DeviceSn).Desc("self_support_for_school_ord.id") |
|
|
|
|
|
|
|
|
sess := db.Db.Where("device_sn = ?", v.DeviceSn).And("enterprise_id =?", req.EnterpriseId).Desc("self_support_for_school_ord.id") |
|
|
if req.EnterpriseId != 0 { |
|
|
if req.EnterpriseId != 0 { |
|
|
sess.And("self_support_for_school_ord.enterprise_id =?", req.EnterpriseId) |
|
|
sess.And("self_support_for_school_ord.enterprise_id =?", req.EnterpriseId) |
|
|
} |
|
|
} |
|
|