> For the complete documentation index, see [llms.txt](https://kopens.gitbook.io/plantpulse-platform/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kopens.gitbook.io/plantpulse-platform/developer/api-manual/employee-service.md).

# 14. Employee 서비스

`client.employee()` 으로 접근합니다. 직원(Employee)의 CRUD와 카운트를 제공합니다.

## 14.1 메서드 일람

| 메서드                                      | 반환 타입                          | HTTP   | 엔드포인트                          |
| ---------------------------------------- | ------------------------------ | ------ | ------------------------------ |
| `create(EmployeeRequestV5)`              | `EmployeeResponseV5` 또는 `null` | POST   | `/api/v5/employee`             |
| `update(employee_id, EmployeeRequestV5)` | `EmployeeResponseV5` 또는 `null` | PUT    | `/api/v5/employee/{id}`        |
| `delete(employee_id)`                    | `boolean`                      | DELETE | `/api/v5/employee/{id}`        |
| `get(employee_id)`                       | `EmployeeResponseV5` 또는 `null` | GET    | `/api/v5/employee/{id}`        |
| `list()`                                 | `List<EmployeeResponseV5>`     | GET    | `/api/v5/employee`             |
| `exists(employee_id)`                    | `boolean`                      | GET    | `/api/v5/employee/{id}/exists` |
| `count()`                                | `long`                         | GET    | `/api/v5/employee/count`       |

## 14.2 EmployeeRequestV5 / EmployeeResponseV5

| 필드            | 타입     | 설명                                             |
| ------------- | ------ | ---------------------------------------------- |
| `employee_id` | String | 직원 ID (PK, 보통 사번)                              |
| `name`        | String | 이름                                             |
| `site_id`     | String | 소속 사이트                                         |
| `org_id`      | String | 조직 ID                                          |
| `email`       | String | 이메일                                            |
| `phone`       | String | 전화번호                                           |
| `role_code`   | String | 역할 코드 (`OPERATOR`, `SUPERVISOR`, `ENGINEER` 등) |
| `department`  | String | 부서                                             |

## 14.3 사용 예시

### 직원 생성

```java
import plantpulse.api.v5.dto.request.EmployeeRequestV5;
import plantpulse.api.v5.dto.response.EmployeeResponseV5;

EmployeeRequestV5 req = new EmployeeRequestV5();
req.setEmployee_id("EMP_E12345");
req.setName("홍길동");
req.setSite_id("SITE_DJ");
req.setOrg_id("ORG_100");
req.setEmail("hong@example.com");
req.setPhone("01012345678");
req.setRole_code("OPERATOR");
req.setDepartment("생산1팀");

EmployeeResponseV5 created = client.employee().create(req);
```

### 조회

```java
EmployeeResponseV5 emp = client.employee().get("EMP_E12345");
if (emp != null) {
    System.out.println(emp.getName() + " - " + emp.getDepartment());
}
```

### 전체 목록 + 부서별 필터링

```java
import java.util.List;
import java.util.stream.Collectors;

List<EmployeeResponseV5> all = client.employee().list();

List<EmployeeResponseV5> 생산1팀 = all.stream()
        .filter(e -> "생산1팀".equals(e.getDepartment()))
        .collect(Collectors.toList());
```

### 카운트

```java
long total = client.employee().count();
```

### 수정 / 삭제

```java
EmployeeRequestV5 update = new EmployeeRequestV5();
update.setEmployee_id("EMP_E12345");
update.setName("홍길동");
update.setSite_id("SITE_DJ");
update.setRole_code("SUPERVISOR");          // 승진
client.employee().update("EMP_E12345", update);

client.employee().delete("EMP_E12345");
```

## 다음 단계

* [Customer 서비스](/plantpulse-platform/developer/api-manual/customer-service.md)
* [Product 서비스](/plantpulse-platform/developer/api-manual/product-service.md)
* [Order 서비스](/plantpulse-platform/developer/api-manual/order-service.md) — 작업지시에 직원 할당
