diff --git a/app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go b/app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go index f8e248d..7a50c71 100644 --- a/app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go +++ b/app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go @@ -800,10 +800,9 @@ func CentralKitchenForSchoolOrdStatistics(req md.CentralKitchenForSchoolOrdListR if len(classWithUserIdentityIdsTwo) > 0 { sess.In("user_identity.id", classWithUserIdentityIdsTwo) } - var sess1, sess2, sess3, sess4, sess5 = sess, sess, sess, sess, sess var m []*db.CentralKitchenForSchoolPackageOrdWithUserIdentity - personNum, err = sess1. + personNum, err = sess. Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id"). Join("LEFT", "enterprise", "enterprise.id = user_identity.enterprise_id"). Join("LEFT", "user", "user.id = user_identity.uid"). @@ -816,7 +815,7 @@ func CentralKitchenForSchoolOrdStatistics(req md.CentralKitchenForSchoolOrdListR return 0, 0, 0, 0, 0, err } - orderCountByTerm, err = sess2.And("central_kitchen_for_school_package_ord.kind = ?", 1). + orderCountByTerm, err = sess.And("central_kitchen_for_school_package_ord.kind = ?", 1). Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id"). Join("LEFT", "enterprise", "enterprise.id = user_identity.enterprise_id"). Join("LEFT", "user", "user.id = user_identity.uid"). @@ -827,7 +826,7 @@ func CentralKitchenForSchoolOrdStatistics(req md.CentralKitchenForSchoolOrdListR if err != nil { return 0, 0, 0, 0, 0, err } - orderCountByMonth, err = sess3.And("central_kitchen_for_school_package_ord.kind = ?", 2). + orderCountByMonth, err = sess.And("central_kitchen_for_school_package_ord.kind = ?", 2). Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id"). Join("LEFT", "enterprise", "enterprise.id = user_identity.enterprise_id"). Join("LEFT", "user", "user.id = user_identity.uid"). @@ -838,7 +837,7 @@ func CentralKitchenForSchoolOrdStatistics(req md.CentralKitchenForSchoolOrdListR if err != nil { return 0, 0, 0, 0, 0, err } - orderCountByDay, err = sess4.And("central_kitchen_for_school_package_ord.kind = ?", 3). + orderCountByDay, err = sess.And("central_kitchen_for_school_package_ord.kind = ?", 3). Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id"). Join("LEFT", "enterprise", "enterprise.id = user_identity.enterprise_id"). Join("LEFT", "user", "user.id = user_identity.uid"). @@ -851,7 +850,7 @@ func CentralKitchenForSchoolOrdStatistics(req md.CentralKitchenForSchoolOrdListR } var mm db.CentralKitchenForSchoolPackageOrdWithUserIdentity - consumeAmount, err = sess5. + consumeAmount, err = sess. Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id"). Join("LEFT", "enterprise", "enterprise.id = user_identity.enterprise_id"). Join("LEFT", "user", "user.id = user_identity.uid").