# `Sp_deleteModuleChildPro` (procedure)

> 根据模块sId删除模块（包含子模块）


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

## Body

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

## Narrative

**Business context:** 系统管理 → 模块管理 — cascade-delete a `gdsmodule` row and every descendant module, along with every form/chart/permission/parameter/bill-no row owned by any descendant. Invoked when an administrator removes a menu node or when the framework needs to drop a module subtree as part of a delete batch.

**What it does:** Walks the `gdsmodule` parent-tree by `FIND_IN_SET(sParentId, idChd)` until no new descendants appear, accumulating all sIds into `ids`. Then `DELETE`s from `gdsmodule`, `gdsformconst`, `gdsjurisdiction` (all by sId / sParentId in `ids`), collects child form-master sIds into `sParentIds` and deletes their `gdsconfigformmaster/slave/customslave/userslave` rows, repeats the same for chart-master (`gdsconfigcharmaster/slave`), and finally clears `gdsparameter` and `sysbillnosettings` rows tied to those sIds.

**Invocation:** Called as a CALLABLE statement `{call Sp_deleteModuleChildPro(?,?,?)}` declared in `GdsmoduleMapper.xml#deleteModuleChildPro`, invoked by `gdsmoduleDao.deleteModuleChildPro(map)` from two Java sites: `GdsmoduleServiceImpl` (admin-side module delete) and `BusinessBaseServiceImpl` (cascaded module cleanup during business-data delete chains). Install body: `script/标版/30100101/Sp_deleteModuleChildPro.sql`.
