---

# Business Logic — JBSbatKKSmtvlRnkiInfCst.executeKU_T_SVKEI_KOJIAK_KK_SELECT_007() [10 LOC]

| Field | Value |
|-------|-------|
| Fully Qualified Name | `eo.business.service.JBSbatKKSmtvlRnkiInfCst` |
| Layer | Batch / Business Service |
| Module | `service` (Package: `eo.business.service`) |

## 1. Role

### JBSbatKKSmtvlRnkiInfCst.executeKU_T_SVKEI_KOJIAK_KK_SELECT_007()

This method performs a database read operation on the **KU_T_SVKEI_KOJIAK** table (Service Contract Construction Case table), which stores the mapping between service contracts and their associated construction case records in the K-Opticom customer base system. The method acts as a specialized **SQL delegate** that packages two bind variables — a service contract number and a construction case number — into a `JBSbatCommonDBInterface` list and dispatches them to a predefined SQL query (`KK_SELECT_007`). Its role in the larger system is as a **data retrieval helper** within a batch processing flow: it is invoked from the parent `execute()` method to check whether a specific construction case exists for a given service contract (specifically, during new-construction completion confirmation). This method follows the standard batch access pattern used throughout the class — create a parameter interface, populate it with bind values, and delegate to `db_KU_T_SVKEI_KOJIAK.selectBySqlDefine()`.

## 2. Processing Pattern (Detailed Business Logic)

```mermaid
flowchart TD
    START(["executeKU_T_SVKEI_KOJIAK_KK_SELECT_007(Object[] param)"])
    STEP1["Create JBSbatCommonDBInterface paramList"]
    STEP2["paramList.setValue(param[0]) - Service Contract Number"]
    STEP3["paramList.setValue(param[1]) - Construction Case Number"]
    STEP4["db_KU_T_SVKEI_KOJIAK.selectBySqlDefine(paramList, KK_SELECT_007)"]
    END_NODE["Return / Next"]

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

## 3. Parameter Analysis

| No | Parameter Name | Type | Business Description |
|----|---------------|------|---------------------|
| 1 | `param` | `Object[]` | An array of two bind variables: `param[0]` is the **Service Contract Number** (service detail work number, e.g., `svc_kei_ucwk_no`), and `param[1]` is the **Construction Case Number** (`kojak_no`). These two values form the composite lookup key to query the `KU_T_SVKEI_KOJIAK` table. The caller constructs this array inline using `new String[]{...}` (see Section 5 for callers). |

**Instance fields / external state read:**

| Field | Type | Business Description |
|-------|------|---------------------|
| `db_KU_T_SVKEI_KOJIAK` | `JBSbatSQLAccess` | Database access object initialized against the `KU_T_SVKEI_KOJIAK` table. Provides `selectBySqlDefine()` for SQL execution and `selectNext()` for result iteration. |

## 4. CRUD Operations / Called Services

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

| CRUD | SC / CBS | SC Code | Entity / DB | Operation Description |
|------|----------|---------|-------------|----------------------|
| R | `db_KU_T_SVKEI_KOJIAK.selectBySqlDefine()` | - | `KU_T_SVKEI_KOJIAK` (Service Contract Construction Case) | Executes the predefined SQL query `KK_SELECT_007` to read records from the `KU_T_SVKEI_KOJIAK` table using the provided bind variables (service contract number, construction case number). Returns a result set accessible via subsequent `selectNext()` calls. |

**CRUD classification:** `R` (Read) — This is a pure database SELECT operation. The method name `selectBySqlDefine` and the constant `KK_SELECT_007` confirm this is a read-only query. The result is stored in the `db_KU_T_SVKEI_KOJIAK` access object and retrieved by the caller via `selectNext()`.

## 5. Dependency Trace

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

No screen/batch entry points found within 8 hops. Direct callers found: 1 methods.
Terminal operations from this method: `selectBySqlDefine` [-]

Trace who calls this method and what this method ultimately calls.

| # | Caller (Screen/Batch) | Call Chain (Full Path to this Method) | Terminal (SC / CRUD / Entity) |
|---|----------------------|--------------------------------------|-------------------------------|
| 1 | Batch: JBSbatKKSmtvlRnkiInfCst | `JBSbatKKSmtvlRnkiInfCst.execute()` -> `executeKU_T_SVKEI_KOJIAK_KK_SELECT_007()` | `selectBySqlDefine [R] KU_T_SVKEI_KOJIAK` |
| 2 | Batch: JBSbatKKPlaceNoChgRnkiInfCst | `JBSbatKKPlaceNoChgRnkiInfCst.execute()` -> `executeKU_T_SVKEI_KOJIAK_KK_SELECT_007()` | `selectBySqlDefine [R] KU_T_SVKEI_KOJIAK` |
| 3 | Batch: JBSbatKKFmtcelSodUpdInfCst | `JBSbatKKFmtcelSodUpdInfCst.execute()` -> `executeKU_T_SVKEI_KOJIAK_KK_SELECT_007()` | `selectBySqlDefine [R] KU_T_SVKEI_KOJIAK` |
| 4 | Batch: JBSbatKKAdChgAddDataCst | `JBSbatKKAdChgAddDataCst.execute()` -> `executeKU_T_SVKEI_KOJIAK_KK_SELECT_007()` | `selectBySqlDefine [R] KU_T_SVKEI_KOJIAK` |
| 5 | Batch: JBSbatKKSodUpdInfCst | `JBSbatKKSodUpdInfCst.execute()` -> `executeKU_T_SVKEI_KOJIAK_KK_SELECT_007()` | `selectBySqlDefine [R] KU_T_SVKEI_KOJIAK` |

**Caller context from JBSbatKKSmtvlRnkiInfCst:** The method is invoked within a loop that iterates over construction completion work records (`KK_T_KJ_FIN_WK` retrieved by `KK_SELECT_020`). For each construction completion record, it looks up the corresponding entry in `KU_T_SVKEI_KOJIAK` using the interface number (`CHAF_SKBT_NO`) and construction case number (`KOJIAK_NO`). If a matching record is found (via `selectNext() != null`), the batch outputs data to `outMap` (IF-m267 format), which triggers downstream processing such as intermediate file generation.

## 6. Per-Branch Detail Blocks

**Block 1** — [SET/INIT] `(no condition)` (L440)

> Business description: Initialize the bind variable parameter list by creating a `JBSbatCommonDBInterface` object and populating it with the two bind variables from the `param` array (service contract number and construction case number), then execute the SQL query.

| # | Type | Code |
|---|------|------|
| 1 | SET | `JBSbatCommonDBInterface paramList = new JBSbatCommonDBInterface();` // Create bind variable list [-> "バインド変数のリストを生成します"] |
| 2 | EXEC | `paramList.setValue(param[0]);` // Set service contract number (bind variable 1) |
| 3 | EXEC | `paramList.setValue(param[1]);` // Set construction case number (bind variable 2) |

**Block 2** — [CALL] `(no condition)` (L448)

> Business description: Execute the predefined SQL query `KK_SELECT_007` against the `KU_T_SVKEI_KOJIAK` table using the prepared parameter list. The result is stored internally in `db_KU_T_SVKEI_KOJIAK` for the caller to retrieve via `selectNext()`.

| # | Type | Code |
|---|------|------|
| 1 | CALL | `db_KU_T_SVKEI_KOJIAK.selectBySqlDefine(paramList, KU_T_SVKEI_KOJIAK_KK_SELECT_007);` // Execute SQL [-> "DBアクセスを実行します"] |

## 7. Glossary

| Term | Type | Business Meaning |
|------|------|------------------|
| `KU_T_SVKEI_KOJIAK` | Table | Service Contract Construction Case table — stores the relationship between service contracts (service detail work numbers) and construction case numbers |
| `KK_SELECT_007` | SQL Key | Predefined SQL query key for SELECT operations on the `KU_T_SVKEI_KOJIAK` table, keyed by service contract number and construction case number |
| `db_KU_T_SVKEI_KOJIAK` | Field | Database access object (`JBSbatSQLAccess`) bound to the `KU_T_SVKEI_KOJIAK` table, used for all CRUD operations on this table |
| `JBSbatCommonDBInterface` | Class | Framework interface for database bind variables — a parameter container used to pass values to SQL queries |
| `JBSbatSQLAccess` | Class | Framework class for SQL execution — provides `selectBySqlDefine()` and `selectNext()` methods for database access |
| `selectBySqlDefine()` | Method | Executes a predefined SQL query (identified by SQL key) with the given bind parameters, storing results internally |
| `selectNext()` | Method | Returns the next row from the previously executed query result set as a `JBSbatCommonDBInterface`, or `null` if exhausted |
| Service Contract Number | Field | Service detail work number (`svc_kei_ucwk_no` / `ITNM_SVC_KEI_NO`) — identifies a specific line item within a service contract |
| Construction Case Number | Field | Construction case number (`kojak_no` / `KOJIAK_NO`) — identifies a construction case record associated with a service contract |
| CHAF_SKBT_NO | Field | Changed interface service bundle number — the service bundle number after a change (address change context) |
| KK_T_KJ_FIN_WK | Table | Construction completion work table — temporary work table holding construction completion records |
| KK_SELECT_020 | SQL Key | Predefined SQL query key for reading construction completion work records |
| IF-m267 | Interface | Output interface format (JBSbatKKIFM267) for address change detail data output |
| K-Opticom | System | Customer base system — the underlying enterprise system for telecommunications customer data management |
| Batch | Context | This method operates in batch processing mode — invoked from batch entry points, not real-time screens |
| 工事案件 | Japanese term | Construction case — the field name `KOJIAK` in Japanese refers to a construction project/case tied to a service contract |
| サービス契約 | Japanese term | Service contract — the field name `SVKEI` refers to a service contract or service detail |
