# `sp_do_initsysjurisdiction` (procedure) > 初始化权限 - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters _No parameters._ ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `sp_do_initsysjurisdiction`'`._ ## Narrative **Business context:** 初始化权限 — system-level permission seeding / repair. Rebuilds `sysjurisdiction` so every leaf-module's menu node and every action button has a permission row. Run during install (initial seed) and after permission-tree edits when an admin needs the permission set re-derived from the module tree. **What it does:** Backs `sysjurisdiction` up into `table_initsysjurisdictionbak`. (Re-)creates two staging tables `sp_do_initsysjurisdiction` and `sp_do_initsysjurisdiction_action` (same shape as `sysjurisdiction`) with indexes on `sAction`, `sJurisdictionClassifyId`, `sParentId`. Refreshes every `gdsmodule.sAllId` via `Fn_find_modleAllId(sId)`; appends an `sAllId` column to `gdsjurisdiction` (via `zAddField_Proc`) and recomputes it as `Fn_find_modleAllId(sParentId)+'-'+sId`. Builds temp `gdsmodule_tmp` filtered to "real" modules (`sDisplayType` not in System/interface, `sName <> ''`) and a `sysjurisdiction_tmp` cohort to derive the leaf-permission rows. (The bulk of the action-row INSERT is left commented in this version; production tenants rely on the menu-row pass.) **Invocation:** Status: appears orphaned in code paths — no `gdsmodule` hook, no `gdsconfigformmaster` data-source, no other routine references it, only the install script `script/标版/30100101/sp_do_initsysjurisdiction.sql`. Designed for manual / one-shot invocation by a DBA after permission-tree changes; consider auditing whether `Sp_Init_*` family or a Java admin tool now does this instead.