# `getModuleTreePro` (procedure)

> 获取模块树


- **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 | `sHandModeType` | `varchar(255)` |

## Body

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

## Narrative

**Business context:** 系统管理 / 模块树 — assembles the top-level admin menu tree for the gdsmodule maintenance UI. Used when a sysadmin opens the module-management page and needs to see every `gdsmodule` row in a hierarchical tree.

**What it does:** Cursors over the root-level `gdsmodule` rows (`sParentId=''`) for the given brand/subsidiary in `iOrder` order, emits each as a JSON-like fragment with `sName/iOrder/sParentId/sAllId/key/sUserType/isLeaf/sId/showName`, and recursively descends via `CALL getModuleChildrenPro` for any node whose children exist. Returns the concatenated `treeNode` string.

**Invocation:** Reached from `MenuServiceImpl.getModuleTreePro()` via MyBatis mapper `GdsmoduleMapper.xml` (`<select id="getModuleTreePro" statementType="CALLABLE">`). The Java side wraps the call with `@Cacheable(value="getModuleTreePro")` and the HTTP endpoint is `GdsmoduleController.getModuleTreePro()` at `GET /getModuleTreePro`. Cache is evicted by `GdsmoduleServiceImpl` whenever a module row is saved/deleted.
