refactor: [hr] 사번(employee_code) 필드 전체 제거

- Model: appends, accessor 제거
- Service: 검색 필터, json_extra 저장/수정 로직 제거
- Controller: validation 규칙 제거
- View: create, edit, show, table에서 사번 UI 제거
This commit is contained in:
김보곤
2026-02-26 18:50:12 +09:00
parent 442533e7c8
commit a1ca8b7e46
7 changed files with 3 additions and 44 deletions

View File

@@ -85,7 +85,6 @@ public function store(Request $request): JsonResponse
'employee_status' => 'nullable|string|in:active,leave,resigned',
'manager_user_id' => 'nullable|integer|exists:users,id',
'display_name' => 'nullable|string|max:50',
'employee_code' => 'nullable|string|max:30',
'hire_date' => 'nullable|date',
'address' => 'nullable|string|max:200',
'emergency_contact' => 'nullable|string|max:100',
@@ -154,7 +153,6 @@ public function update(Request $request, int $id): JsonResponse
'employee_status' => 'nullable|string|in:active,leave,resigned',
'manager_user_id' => 'nullable|integer|exists:users,id',
'display_name' => 'nullable|string|max:50',
'employee_code' => 'nullable|string|max:30',
'hire_date' => 'nullable|date',
'address' => 'nullable|string|max:200',
'emergency_contact' => 'nullable|string|max:100',

View File

@@ -38,7 +38,6 @@ class Employee extends Model
];
protected $appends = [
'employee_code',
'hire_date',
'position_label',
'job_title_label',
@@ -67,11 +66,6 @@ public function manager(): BelongsTo
// json_extra Accessor
// =========================================================================
public function getEmployeeCodeAttribute(): ?string
{
return $this->json_extra['employee_code'] ?? null;
}
public function getHireDateAttribute(): ?string
{
return $this->json_extra['hire_date'] ?? null;

View File

@@ -24,7 +24,7 @@ public function getEmployees(array $filters = [], int $perPage = 20): LengthAwar
->with(['user', 'department'])
->forTenant($tenantId);
// 검색 필터 (이름, 사번, 이메일)
// 검색 필터 (이름, 이메일, 연락처)
if (! empty($filters['q'])) {
$search = $filters['q'];
$query->where(function ($q) use ($search) {
@@ -33,8 +33,7 @@ public function getEmployees(array $filters = [], int $perPage = 20): LengthAwar
$uq->where('name', 'like', "%{$search}%")
->orWhere('email', 'like', "%{$search}%")
->orWhere('phone', 'like', "%{$search}%");
})
->orWhereRaw("JSON_UNQUOTE(JSON_EXTRACT(json_extra, '$.employee_code')) LIKE ?", ["%{$search}%"]);
});
});
}
@@ -189,9 +188,6 @@ public function createEmployee(array $data): Employee
// json_extra 구성
$jsonExtra = [];
if (! empty($data['employee_code'])) {
$jsonExtra['employee_code'] = $data['employee_code'];
}
if (! empty($data['hire_date'])) {
$jsonExtra['hire_date'] = $data['hire_date'];
}
@@ -244,7 +240,7 @@ public function updateEmployee(int $id, array $data): ?Employee
], fn ($v) => $v !== null);
// json_extra 업데이트
$jsonExtraKeys = ['employee_code', 'hire_date', 'address', 'emergency_contact', 'salary', 'bank_account'];
$jsonExtraKeys = ['hire_date', 'address', 'emergency_contact', 'salary', 'bank_account'];
$extra = $employee->json_extra ?? [];
foreach ($jsonExtraKeys as $key) {
if (array_key_exists($key, $data)) {

View File

@@ -109,16 +109,6 @@ class="text-xs text-red-500 hover:text-red-700 font-medium shrink-0">
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
</div>
{{-- 사번 --}}
<div>
<label for="employee_code" class="block text-sm font-medium text-gray-700 mb-1">
사번
</label>
<input type="text" name="employee_code" id="employee_code"
placeholder="EMP-001"
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
</div>
{{-- 이메일 / 연락처 --}}
<div class="flex gap-4" style="flex-wrap: wrap;">
<div style="flex: 1 1 200px;">

View File

@@ -50,14 +50,6 @@ class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:rin
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
</div>
{{-- 사번 --}}
<div>
<label for="employee_code" class="block text-sm font-medium text-gray-700 mb-1">사번</label>
<input type="text" name="employee_code" id="employee_code"
value="{{ $employee->employee_code }}"
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
</div>
{{-- 이메일 / 연락처 --}}
<div class="flex gap-4" style="flex-wrap: wrap;">
<div style="flex: 1 1 200px;">

View File

@@ -26,9 +26,6 @@ class="flex items-center gap-3 group">
<div class="text-sm font-medium text-gray-900 group-hover:text-blue-600">
{{ $employee->display_name ?? $employee->user?->name ?? '-' }}
</div>
@if($employee->employee_code)
<div class="text-xs text-gray-400">{{ $employee->employee_code }}</div>
@endif
</div>
</a>
</td>

View File

@@ -35,10 +35,6 @@ class="inline-flex items-center gap-2 px-4 py-2 bg-blue-600 hover:bg-blue-700 te
{{ $employee->display_name ?? $employee->user?->name ?? '-' }}
</h2>
<div class="flex flex-wrap items-center gap-2 mt-1">
@if($employee->employee_code)
<span class="text-sm text-gray-500">{{ $employee->employee_code }}</span>
<span class="text-gray-300">|</span>
@endif
@if($employee->department)
<span class="text-sm text-gray-500">{{ $employee->department->name }}</span>
<span class="text-gray-300">|</span>
@@ -81,10 +77,6 @@ class="inline-flex items-center gap-2 px-4 py-2 bg-blue-600 hover:bg-blue-700 te
<div class="shrink-0 text-sm font-medium text-gray-500" style="width: 140px;">표시 이름</div>
<div class="text-sm text-gray-900">{{ $employee->display_name ?? '-' }}</div>
</div>
<div class="px-6 py-3 flex" style="flex-wrap: wrap;">
<div class="shrink-0 text-sm font-medium text-gray-500" style="width: 140px;">사번</div>
<div class="text-sm text-gray-900">{{ $employee->employee_code ?? '-' }}</div>
</div>
<div class="px-6 py-3 flex" style="flex-wrap: wrap;">
<div class="shrink-0 text-sm font-medium text-gray-500" style="width: 140px;">이메일</div>
<div class="text-sm text-gray-900">{{ $employee->user?->email ?? '-' }}</div>