# Business Logic — JBSbatTUBmpSwchSodTrn.executeTU_T_BMP_KOJI_PKUPDATE() [14 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatTUBmpSwchSodTrn` |
| Layer | Batch (Service Component within the batch processing layer) |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatTUBmpSwchSodTrn.executeTU_T_BMP_KOJI_PKUPDATE()

This method performs a **primary key-based update** on the Area Construction (番線工事, `BMP_KOJI`) entity within the batch service workflow for switching service orders. Its business purpose is to update the construction status of a specific area construction record, identified by a unique area construction number (`BMP_KOJI_NO`) and a generation timestamp (`GENE_ADD_DTM`). The method follows a **delegation pattern**: it maps input parameters into structured data interfaces (`JBSbatCommonDBInterface`), separating the "set" fields (values to update) from the "where" fields (primary key conditions), and delegates the actual database persistence to the `JBSbatSQLAccess` instance (`db_TU_T_BMP_KOJI`). It acts as a reusable internal utility called by other batch processing methods within the same class (`executeTU_T_BMP_KOJI()`) and by peer batch classes (`JBSbatTUBmpKojiFinTrn`, `JBSbatTUJgskAdjRsltTrkm`, `JBSbatTUDojiBmpKiboRnkTrn`, `JBSbatTUCustTorkRnkTrn`, `JBSbatTUBmpMskmHjChsht`) that need to update the construction status of records. The Javadoc describes this operation as "PK Update" (PK 更新, Primary Key Update) — a precise database write targeting a record uniquely identified by its composite key.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeTU_T_BMP_KOJI_PKUPDATE setParam, whereParam"])
    STEP1["Create setMap
(JBSbatCommonDBInterface)"]
    STEP2["setMap setValue BMP_KOJI_STAT from setParam[0]"]
    STEP3["Create whereMap
(JBSbatCommonDBInterface)"]
    STEP4["whereMap setValue BMP_KOJI_NO from whereParam[0]"]
    STEP5["whereMap setValue GENE_ADD_DTM from whereParam[1]"]
    STEP6["db_TU_T_BMP_KOJI updateByPrimaryKeys whereMap, setMap"]
    END_NODE(["Return / Next"])

    START --> STEP1 --> STEP2 --> STEP3 --> STEP4 --> STEP5 --> STEP6 --> END_NODE
```

This method executes a **linear, unconditional flow** with no branching logic. The steps are:

1. **Create the set map** — Instantiate a `JBSbatCommonDBInterface` object to hold the values to be written to the database.
2. **Set the construction status** — Extract the first element (`setParam[0]`) and bind it to the `BMP_KOJI_STAT` field. This is the only field being updated.
3. **Create the where map** — Instantiate another `JBSbatCommonDBInterface` object to hold the primary key conditions.
4. **Set the area construction number** — Extract the first element (`whereParam[0]`) and bind it to `BMP_KOJI_NO`, the first part of the composite primary key.
5. **Set the generation timestamp** — Extract the second element (`whereParam[1]`) and bind it to `GENE_ADD_DTM`, the second part of the composite primary key.
6. **Execute the update** — Call `db_TU_T_BMP_KOJI.updateByPrimaryKeys(whereMap, setMap)` to perform the database update on table `TU_T_BMP_KOJI`, targeting records that match both primary key values.

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `setParam` | `Object[]` | An array holding the **construction status value** at index 0. This represents the new status of an area construction record (e.g., whether the construction has been completed, is in progress, or has been canceled). The batch system uses this to update the record's progress state. |
| 2 | `whereParam` | `Object[]` | An array holding the **composite primary key values** for identifying the target record: index 0 is the area construction number (`BMP_KOJI_NO`) and index 1 is the generation timestamp (`GENE_ADD_DTM`). Together, these uniquely identify the record to update, preventing accidental updates to unintended rows. |

**Instance Fields Read:**
| Field | Type | Business Description |
|-------|------|---------------------|
| `db_TU_T_BMP_KOJI` | `JBSbatSQLAccess` | The SQL access instance configured for the `TU_T_BMP_KOJI` table, providing primary key-based update capability |

## 4. CRUD Operations / Called Services

### Pre-computed evidence from code analysis graph:

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| U | `db_TU_T_BMP_KOJI.updateByPrimaryKeys` | — | `TU_T_BMP_KOJI` | Updates the `BMP_KOJI_STAT` (construction status) field of a record in the Area Construction table, identified by its composite primary key (`BMP_KOJI_NO` + `GENE_ADD_DTM`). This is the sole database operation performed by this method. |

## 5. Dependency Trace

### Pre-computed evidence from code analysis graph:

Direct callers found: 1 methods.
Terminal operations from this method: `updateByPrimaryKeys` [`TU_T_BMP_KOJI` table update]

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: `JBSbatTUBmpSwchSodTrn.execute()` | `execute()` -> `executeTU_T_BMP_KOJI_PKUPDATE()` | `updateByPrimaryKeys [U] TU_T_BMP_KOJI` |

**Cross-class callers of this method pattern:**

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 2 | Batch: `JBSbatTUBmpKojiFinTrn.executeTU_T_BMP_KOJI()` | `executeTU_T_BMP_KOJI()` -> `executeTU_T_BMP_KOJI_PKUPDATE()` | `updateByPrimaryKeys [U] TU_T_BMP_KOJI` |
| 3 | Batch: `JBSbatTUJgskAdjRsltTrkm.executeTU_T_BMP_KOJI_UPD_BMP()` | `executeTU_T_BMP_KOJI_UPD_BMP()` -> `executeTU_T_BMP_KOJI_PKUPDATE()` | `updateByPrimaryKeys [U] TU_T_BMP_KOJI` |
| 4 | Batch: `JBSbatTUDojiBmpKiboRnkTrn.executeTU_T_BMP_KOJI()` | `executeTU_T_BMP_KOJI()` -> `executeTU_T_BMP_KOJI_PKUPDATE()` | `updateByPrimaryKeys [U] TU_T_BMP_KOJI` |
| 5 | Batch: `JBSbatTUCustTorkRnkTrn.executeTU_T_BMP_KOJI()` | `executeTU_T_BMP_KOJI()` -> `executeTU_T_BMP_KOJI_PKUPDATE()` | `updateByPrimaryKeys [U] TU_T_BMP_KOJI` |
| 6 | Batch: `JBSbatTUBmpMskmHjChsht.executeTU_T_BMP_KOJI()` | `executeTU_T_BMP_KOJI()` -> `executeTU_T_BMP_KOJI_PKUPDATE()` | `updateByPrimaryKeys [U] TU_T_BMP_KOJI` |

This method is a **shared batch utility** — the same method signature and pattern is replicated across multiple batch processing classes. Each caller adapts the `setParam` and `whereParam` arrays to pass the appropriate construction status value and primary key values. The method serves as a **canonical PK-update helper** used across the batch system.

## 6. Per-Branch Detail Blocks

Since this method contains no conditional branches, it has a single sequential block:

**Block 1** — [SEQUENTIAL] `(no condition — straight-through execution)` (L608)

> Create the set map and populate it with the construction status value from the input parameter.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `JBSbatCommonDBInterface setMap = new JBSbatCommonDBInterface();` | Instantiate a new structured map object to hold the update values to be written to the database |
| 2 | EXEC | `setMap.setValue("BMP_KOJI_STAT", setParam[0]);` | Bind the construction status value (from `setParam[0]`) to the `BMP_KOJI_STAT` field key. This is the single column being updated by this operation. |

**Block 2** — [SEQUENTIAL] `(no condition — straight-through execution)` (L612)

> Create the where map and populate it with the composite primary key values for record identification.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | SET | `JBSbatCommonDBInterface whereMap = new JBSbatCommonDBInterface();` | Instantiate a new structured map object to hold the primary key conditions used to locate the target record |
| 2 | EXEC | `whereMap.setValue("BMP_KOJI_NO", whereParam[0]);` | Bind the area construction number (from `whereParam[0]`) to the `BMP_KOJI_NO` field key — the first element of the composite primary key |
| 3 | EXEC | `whereMap.setValue("GENE_ADD_DTM", whereParam[1]);` | Bind the generation timestamp (from `whereParam[1]`) to the `GENE_ADD_DTM` field key — the second element of the composite primary key. This ensures the update targets exactly one specific record version. |

**Block 3** — [SEQUENTIAL] `(no condition — straight-through execution)` (L616)

> Execute the primary key-based database update.

| # | Type | Code | Business Description |
|---|------|------|---------------------|
| 1 | CALL | `db_TU_T_BMP_KOJI.updateByPrimaryKeys(whereMap, setMap);` | Delegate to the SQL access layer to perform an UPDATE on table `TU_T_BMP_KOJI`. The database engine matches records where both `BMP_KOJI_NO` equals the value in `whereMap` AND `GENE_ADD_DTM` equals the value in `whereMap`, then sets `BMP_KOJI_STAT` to the value from `setMap`. |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `BMP_KOJI_STAT` | Field | Area Construction Status — indicates the current state of an area construction record (e.g., in-progress, completed, canceled) |
| `BMP_KOJI_NO` | Field | Area Construction Number — a unique identifier for an area construction project, serving as the first part of the composite primary key |
| `GENE_ADD_DTM` | Field | Generated Addition Datetime — the timestamp when the record was originally created/inserted into the database, serving as the second part of the composite primary key to ensure record version uniqueness |
| `TU_T_BMP_KOJI` | Table | Area Construction Table — the database table storing area construction project records; the `T_` prefix denotes a transactional table in the batch schema |
| `BMP_KOJI` | Abbreviation | Area Construction (番線工事) — a construction project associated with a geographic area/region, as opposed to individual customer-specific work |
| PK Update | Term | Primary Key Update — a database update operation that targets a record uniquely identified by its primary key column(s), ensuring no unintended rows are modified |
| `JBSbatCommonDBInterface` | Class | Batch Common Database Interface — a structured map interface used to hold key-value pairs for database operations (set values and where conditions) |
| `JBSbatSQLAccess` | Class | Batch SQL Access — the core database access abstraction for batch processing, providing methods like `updateByPrimaryKeys`, `selectNext`, `selectBySqlDefine` for CRUD operations against configured tables |
| `TU_T_BMP_KOJI_TU_SELECT_006` | Constant | SQL Definition key for a predefined SELECT query on the Area Construction table (used elsewhere in the class for data retrieval) |
| `TU_T_BMP_KOJI_TU_SELECT_003` | Constant | SQL Definition key for another predefined SELECT query on the Area Construction table |
| Batch | Term | Automated background processing executed outside of user interaction, typically on a scheduled basis to process bulk data operations |
| SOD | Abbreviation | Service Order Data — the business entity representing a service order in the telecommunications fulfillment system |
| `setParam` | Field | Set Parameter array — contains the field values to be written (updated) to the database |
| `whereParam` | Field | Where Parameter array — contains the primary key values used to locate the target record for update |
