# `Sp_DelMasterSlave_Pro2` (procedure)

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


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sGuids` | `varchar(255)` |
| 2 | IN | `sTableName` | `varchar(255)` |
| 3 | IN | `sLoginId` | `varchar(255)` |
| 4 | IN | `sBrId` | `varchar(255)` |
| 5 | IN | `sSuId` | `varchar(255)` |
| 6 | IN | `sType` | `varchar(255)` |
| 7 | OUT | `sCode` | `int` |
| 8 | OUT | `sReturn` | `varchar(5000)` |

## Body

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

## Narrative

**Business context:** Older / alternate variant of `Sp_DelMasterSlave_Pro`. Same core idea — delete a master+slave document with a transaction savepoint — but without the back-write reversal (`Sp_delete_backwriting`) step and without the form-level pre-delete checks. Kept for callers that just need a transactional master+slave drop.

**What it does:** Opens (or joins) a transaction and creates `SAVEPOINT DelPro`. Calls `Sp_UpdateAdd_Check(sGuids, sTableName, sLoginId, sBrId, sSuId, sType='check', @sCode, @sReturn)` and aborts on `<0`. Calls `Sp_GetMasterSlave` to find the master / slave-table set / `delMasterId` / `delSlaveId`. Iterates the slave-table list, special-cases `eleproductstock` to use `sProductId` as the link, and issues dynamic `DELETE FROM <slave> WHERE FIND_IN_SET(<delSlaveId>, sGuids)` and finally `DELETE FROM <master> WHERE FIND_IN_SET(<delMasterId>, sGuids)`. A `SQLEXCEPTION` handler sets `t_error=1`; on error, rolls back to the savepoint and surfaces the SQLEXCEPTION message via `SP_Sis_GetConst`. Otherwise releases the savepoint and commits.

**Invocation:** Status: appears orphaned. No `gdsmodule` hook, no `gdsconfigformmaster` data-source, no other routine references it, no xly-src grep hits beyond this file itself. Production deletes route through `Sp_DelMasterSlave_Pro` instead — this variant looks like a stale alternate; candidate for maintainer audit.
