Sp_DelMasterSlave_Pro (procedure)
根据模块sId删除模块(包含子模块)
- Type: PROCEDURE
- Deterministic: NO
- SQL data access: CONTAINS SQL
Parameters
| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | sGuids |
varchar(255) |
| 2 | IN | sFormGuid |
varchar(100) |
| 3 | IN | sTableName |
varchar(255) |
| 4 | IN | sLoginId |
varchar(255) |
| 5 | IN | sBrId |
varchar(255) |
| 6 | IN | sSuId |
varchar(255) |
| 7 | IN | sType |
varchar(255) |
| 8 | OUT | sCode |
int |
| 9 | OUT | sReturn |
varchar(255) |
Body
Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpDelMasterSlave_Pro'._
Narrative
Business context: Cross-module delete pipeline — the central proc that the Java side dispatches to whenever a user deletes a master+slave document (sales order, purchase order, work order, etc.). Wraps the delete in a savepoint, runs the pre-delete checks, the back-write reversal, and cascades through every dependent slave table for the given master.
What it does: Sets a SQLEXCEPTION continuation handler that flags t_error=1, opens a transaction (if none already), creates SAVEPOINT DelPro. Calls Sp_UpdateAdd_Check with sType='check' to confirm the user is allowed to delete (制单人/审核状态/etc.); calls Sp_GetMasterSlave to resolve (masterTableName, saveTableNames, delMasterId, delSlaveId, sUpdateCloumn) from sTableName. If the master ends in master (and isn't a gds* config table), it short-circuits the delete with "请刷新单据,消审后删除" when any row has bCheck=1. Calls Sp_delete_backwriting to reverse upstream reservations, then for every slave table issues a dynamic DELETE ... WHERE FIND_IN_SET(<delSlaveId>, sGuids) AND sBrandsId=…, then deletes the master rows. On t_error=1, rolls back to DelPro and surfaces the localized SQLEXCEPTION message via SP_Sis_GetConst; otherwise releases the savepoint and commits.
Invocation: Called by BusinessBaseServiceImpl.delMethodPro() — the central document-delete entrypoint. Java builds searMap via procedureService.getDoProMap("Sp_DelMasterSlave_Pro", …), populates sGuids/sTableName/sLoginId/sBrId/sSuId/sFormGuid/iFlag/sType, runs the form-level sDeleteProName pre-hooks via checkUpdate(..., "sDeleteProName"), then procedureService.getCallProByMap(searMap, "Sp_DelMasterSlave_Pro"). xly-src install body: script/标版/30100101/Sp_DelMasterSlave_Pro.sql. Sibling of Sp_DelMasterSlave_Pro2 (a savepoint-only variant without Sp_delete_backwriting).