# `Sp_Post_sModule` (procedure) > @author:zhucx @date:2022.01.02 @describe: 1.PC端-系统设定-开发平台-系统模块-保存之后自动调用本过程 - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `sGuid` | `varchar(100)` | | 2 | IN | `sFormGuid` | `varchar(100)` | | 3 | IN | `sLoginId` | `varchar(100)` | | 4 | IN | `sBrId` | `varchar(100)` | | 5 | IN | `sSuId` | `varchar(100)` | | 6 | OUT | `sReturn` | `varchar(4000)` | | 7 | OUT | `sCode` | `int` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Post_sModule`'`._ ## Narrative **Business context:** 开发平台 → 系统功能模块设置单据 — post-save hook on the 系统模块 (`gdsmodule`) record. Two jobs: (1) maintain the materialised tree path `sAllId` (`-grandparent-parent-self`) whenever the module's parent chain changes, and (2) when the operator copied a template module by setting `sSrcSlaveId` on the new record, clone the template's form-master/slave/jurisdiction/formconst rows into the new module so the copied module is functional immediately. **What it does:** Reads `sAllId` for `sGuid`. If empty, climbs `sParentId` up to two levels and recomputes `sAllId = -p1-p2-self` (or shorter when the chain is shallower). Then reads `sSrcSlaveId`; if set, opens a cursor over `gdsconfigformmaster WHERE sParentId = sSrcSlaveId` and per source form-master: generates a new `p_sParentId1`, INSERTs the matching `gdsconfigformslave` rows pointing at the new id (preserving all 50+ field-config columns), then INSERTs a new `gdsconfigformmaster` row with `sId=p_sParentId1`, `sParentId=sGuid`, copying everything else; finally clones `gdsjurisdiction` and `gdsformconst` rows from the template's `sParentId = sSrcSlaveId` to the new module. Finishes with `UPDATE gdsmodule SET sAllId = p_sAllId WHERE sId = sGuid`. **Invocation:** Bound on `gdsmodule.sSaveProName = 'Sp_Post_sModule'` for `系统功能模块设置单据` (`sId 12012615914116409277657460`) under 开发平台 (`sId 16409269700002288019597983792400`). Runs after any save of a 系统模块 record. Java path: `BusinessBaseServiceImpl` consults `gdsmodule.sSaveProName` post-save. Install scripts ship in `xly-src/script/标版/30100101/Sp_Post_sModule.sql` and an `upgrade/20220119业务界面复制模块后处理/` variant.