From f1a3e0f1649a6f700ef369ae1deaa9d9d7a58afa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9C=A0=EB=B3=91=EC=B2=A0?= Date: Thu, 5 Mar 2026 09:41:54 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20[dashboard-ceo]=20=EA=B3=B5=EC=A0=95?= =?UTF-8?q?=EB=AA=85=20=EC=BB=AC=EB=9F=BC=20=EB=B0=8F=20=EA=B7=BC=ED=83=9C?= =?UTF-8?q?=20=EB=B6=80=EC=84=9C=20=EC=A1=B0=EC=9D=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - processes 테이블: p.name → p.process_name 컬럼명 수정 - 근태: users.department_id → tenant_user_profiles 경유 조인으로 변경 - 직급: users.position → tup.position_key 컬럼 수정 Co-Authored-By: Claude Opus 4.6 --- app/Services/DashboardCeoService.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/Services/DashboardCeoService.php b/app/Services/DashboardCeoService.php index d021e4c..1dccd32 100644 --- a/app/Services/DashboardCeoService.php +++ b/app/Services/DashboardCeoService.php @@ -364,7 +364,7 @@ private function getProductionProcesses(int $tenantId, string $today): array ->leftJoin('processes as p', 'wo.process_id', '=', 'p.id') ->select( 'p.id as process_id', - 'p.name as process_name', + 'p.process_name as process_name', DB::raw('COUNT(*) as total_work'), DB::raw("SUM(CASE WHEN wo.status = 'pending' OR wo.status = 'unassigned' OR wo.status = 'waiting' THEN 1 ELSE 0 END) as todo"), DB::raw("SUM(CASE WHEN wo.status = 'in_progress' THEN 1 ELSE 0 END) as in_progress"), @@ -376,8 +376,8 @@ private function getProductionProcesses(int $tenantId, string $today): array ->where('wo.is_active', true) ->whereNull('wo.deleted_at') ->whereNotNull('wo.process_id') - ->groupBy('p.id', 'p.name') - ->orderBy('p.name') + ->groupBy('p.id', 'p.process_name') + ->orderBy('p.process_name') ->get(); return $processData->map(function ($process) use ($tenantId, $today) { @@ -676,13 +676,17 @@ public function attendanceSummary(): array // 오늘 근태 기록 $attendances = DB::table('attendances as a') ->leftJoin('users as u', 'a.user_id', '=', 'u.id') - ->leftJoin('departments as d', 'u.department_id', '=', 'd.id') + ->leftJoin('tenant_user_profiles as tup', function ($join) use ($tenantId) { + $join->on('tup.user_id', '=', 'u.id') + ->where('tup.tenant_id', '=', $tenantId); + }) + ->leftJoin('departments as d', 'tup.department_id', '=', 'd.id') ->select([ 'a.id', 'a.status', 'u.name', 'd.name as department', - 'u.position', + 'tup.position_key as position', ]) ->where('a.tenant_id', $tenantId) ->where('a.base_date', $today)