fix: [payroll] 급여목록 정렬 기준을 입사일 오름차순으로 변경

This commit is contained in:
김보곤
2026-03-03 11:35:08 +09:00
parent 193cd2666f
commit ec6e33699e

View File

@@ -48,7 +48,13 @@ private function buildFilteredQuery(array $filters = [])
$month = $filters['month'] ?? now()->month;
$query->forPeriod((int) $year, (int) $month);
return $query->orderBy('created_at', 'desc');
return $query
->leftJoin('tenant_user_profiles as emp', function ($join) use ($tenantId) {
$join->on('payrolls.user_id', '=', 'emp.user_id')
->where('emp.tenant_id', '=', $tenantId);
})
->select('payrolls.*')
->orderByRaw("COALESCE(emp.json_extra->>'$.hire_date', '9999-12-31') ASC");
}
/**