# `fun_get_jurisdiction` (function)

> 获取盒型图片


- **Type:** FUNCTION
- **Returns:** `varchar(10)`
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sUserId` | `varchar(100)` |
| 2 | IN | `sModelId` | `varchar(100)` |

## Body

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

## Narrative

**Business context:** Permission gate helper — given a user id and a target model/module id, returns 1 if the user is allowed to operate on it, else 0. The comment header `获取盒型图片` ("get box-type image") is incorrect/copy-paste residue; the actual body reads `sftlogininfo` and `sftlogininfojurisdictiongroup × sysjurisdiction` to authorize.

**What it does:** if `sftlogininfo.sType = 'sysadmin'` for the user, returns 1 unconditionally. Otherwise concatenates all `sysjurisdiction.sKey` values granted to the user (via `sftlogininfojurisdictiongroup`) where `sAction <> ''`, and returns 1 iff `sModelId` appears in that concatenated key list.

**Invocation:** Status: appears orphaned. No caller found in any channel (form-master, gdsmodule hooks, other routines, exhaustive xly-src grep across all extensions) — candidate for maintainer audit. Permission checking in production flows through `BusinessBaseService` / Java filters, not this function.
