From 0694719c90275a47ac6b29370521eaa5cba94e98 Mon Sep 17 00:00:00 2001 From: denghy Date: Fri, 15 Feb 2019 13:47:58 +0800 Subject: [PATCH] groupBy --- app/Domains/Stats/Exports/CompanyReportDetailExport.php | 3 +-- app/Domains/Stats/Services/CompanyReportService.php | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/Domains/Stats/Exports/CompanyReportDetailExport.php b/app/Domains/Stats/Exports/CompanyReportDetailExport.php index 06323d7b..d78e499b 100644 --- a/app/Domains/Stats/Exports/CompanyReportDetailExport.php +++ b/app/Domains/Stats/Exports/CompanyReportDetailExport.php @@ -43,7 +43,6 @@ class CompanyReportDetailExport extends AbstractExport implements FromQuery, Wit 'sim', 'company_id', 'package_id', - 'order_id', 'type', DB::raw('CASE "type" WHEN 3 THEN SUM(counts) ELSE count(*) END AS counts'), 'unit_price' @@ -51,7 +50,7 @@ class CompanyReportDetailExport extends AbstractExport implements FromQuery, Wit $builder = $repository->forceNoReset()->select($select) ->withConditions($this->conditions) - ->groupBy('sim') + ->groupBy('company_id', 'package_id', 'type', 'unit_price', 'sim') ->orderBy('id', 'desc'); return $builder; diff --git a/app/Domains/Stats/Services/CompanyReportService.php b/app/Domains/Stats/Services/CompanyReportService.php index 059cb493..2d62c6ed 100644 --- a/app/Domains/Stats/Services/CompanyReportService.php +++ b/app/Domains/Stats/Services/CompanyReportService.php @@ -79,7 +79,6 @@ class CompanyReportService extends Service 'sim', 'company_id', 'package_id', - 'order_id', 'type', DB::raw('CASE "type" WHEN 3 THEN SUM(counts) ELSE count(*) END AS counts'), 'unit_price' @@ -87,7 +86,7 @@ class CompanyReportService extends Service $query = $this->orderCardPartitionRepository->select($select) ->withConditions($conditions) - ->groupBy('sim') + ->groupBy('company_id', 'package_id', 'type', 'unit_price', 'sim') ->orderBy('id', 'desc'); $res = $query->paginate($conditions['limit']);