fix: [dashboard-ceo] 공정명 컬럼 및 근태 부서 조인 수정
- processes 테이블: p.name → p.process_name 컬럼명 수정 - 근태: users.department_id → tenant_user_profiles 경유 조인으로 변경 - 직급: users.position → tup.position_key 컬럼 수정 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user