# `getModuleKeyPro` (procedure)

> 根据sId获取模块在树种的key


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sbid` | `varchar(255)` |
| 2 | IN | `ssid` | `varchar(255)` |
| 3 | IN | `id` | `varchar(255)` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `getModuleKeyPro`'`._

## Narrative

**Business context:** 系统管理 / 模块树 — translates a single `gdsmodule.sId` to its full hierarchical "key" path (`0-<root>-<parent>-...-<leaf>`). Lets the front-end module-tree UI auto-expand to a specific module when a user navigates by deep-link or after edit.

**What it does:** Walks `gdsmodule.sParentId` upward from `id`, prepending each ancestor's `sId` to the running key, and returns `SELECT CONCAT('0', '-', p_key) AS pkey` as a single-row resultset.

**Invocation:** Reached from `GdsmoduleServiceImpl.getModuleKeyPro()` via DAO `GdsmoduleDao.getModuleKeyPro` and MyBatis mapper `GdsmoduleMapper.xml` (`<select id="getModuleKeyPro" statementType="CALLABLE">`). HTTP endpoint `GdsmoduleController.getModuleKeyPro()` at `GET /getModuleKeyPro`.
