# `Sp_urisdiction` (procedure)


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sBrId` | `varchar(100)` |
| 2 | IN | `sSuId` | `varchar(100)` |
| 3 | IN | `bFilter` | `longtext` |
| 4 | IN | `pageNum` | `int` |
| 5 | IN | `pageSize` | `int` |
| 6 | OUT | `totalCount` | `int` |
| 7 | IN | `countCloumn` | `varchar(5000)` |
| 8 | OUT | `countMapJson` | `longtext` |
| 9 | IN | `sFilterOrderBy` | `varchar(5000)` |
| 10 | IN | `sGroupby_select_sql` | `varchar(5000)` |
| 11 | IN | `sGroupby_group_sql` | `varchar(5000)` |
| 12 | OUT | `sCode` | `int` |
| 13 | OUT | `sReturn` | `varchar(255)` |

## Body

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

## Narrative

**Business context:** 系统权限 — paged tree-view of leaf modules (`gdsmodule` rows with `bJurisdictionShow=1` and no children) annotated with their full parent chain, granted action names, and granted user names. Provides the data backing a jurisdiction-audit report: "which leaf modules exist, what does the parent path look like, who is granted what action".

**What it does:** Builds temp `p_Tmpurisdiction` with up-to-six parent-level columns (`sParentName0..5`, `iParentiOrder0..5`, `ibJurisdictionShow0..3`, `sParentIdM0..5`). Reads `SysSystemSettings.CbxLanguage` to pick the display-language column. Seeds leaves from `gdsmodule WHERE bJurisdictionShow=1 AND sId NOT IN (SELECT sParentId FROM gdsmodule)`, splits the `sAllId` `-`-separated chain via `Fn_split_string` into the six `sParentIdM*` slots, then runs dynamic `Update … JOIN gdsmodule` per level to fetch parent names and `iOrder`. Joins `sisjurisdictionclassify`+`sysjurisdiction` (where `sUserId='' AND sAction=''` — anonymous/template grants) to fill `sName`, and `sftlogininfo`+`sftlogininfojurisdictiongroup` to fill `sUserName`. Returns the temp filtered to `ibJurisdictionShow*` set.

**Invocation:** Status: appears orphaned. The paged-report signature (`bFilter, pageNum, pageSize, totalCount, countCloumn, countMapJson, sFilterOrderBy, sGroupby_select_sql, sGroupby_group_sql`) marks it as a form-master data-source proc, but no `gdsconfigformmaster.sSqlStr/sConfigSqlStr` row references it, no gdsmodule hook, no other proc, and no xly-src grep hit. The name itself is mis-spelled "urisdiction" (missing leading 'j'), which probably explains why a form failed to bind. Candidate for maintainer audit.
