From 83d49bf873819aee99776fca94a64392e4a57f6c Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Thu, 16 Nov 2023 12:08:20 +0800 Subject: [PATCH] update --- app/admin/svc/svc_data_statisstics.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index 0380c81..9fc58f0 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -539,7 +539,7 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta //查询出所有的设备 var deviceList []*model.Device - if req.EnterpriseId != 0 { + if req.EnterpriseId == 0 { err := db.Db.Where("enterprise_id != 0").Find(&deviceList) if err != nil { logx.Error(err) @@ -576,7 +576,7 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta for _, v := range deviceList { deviceListMapping[v.DeviceSn] = *v 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 { sess.And("self_support_for_school_ord.enterprise_id =?", req.EnterpriseId) }