Sp_BtnEventCopyUserJurisdiction.md 1.94 KB

Sp_BtnEventCopyUserJurisdiction (procedure)

人员权限复制

  • Type: PROCEDURE
  • Deterministic: NO
  • SQL data access: CONTAINS SQL

Parameters

# Mode Name Type
1 IN sProInParam longtext
2 IN sMakePerson varchar(100)
3 IN sBrId varchar(100)
4 IN sSuId varchar(100)
5 OUT sReturn longtext
6 OUT sCode int

Body

Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpBtnEventCopyUserJurisdiction'._

Narrative

Business context: 系统权限 / 人员权限 — toolbar handler that clones five user-scoped permission tables from one login (sUserId) to another (sToUserId) within the same brand/subsidiary. Used by admins to mirror a senior user's permission set onto a new hire without rebuilding it field-by-field.

What it does: Parses the last entry from $.params[*].value[*] to get sUserId and sToUserId (returns chooseData via Fun_Sis_GetConstNew if input isn't valid JSON). For each of five tables — sftlogininfojurisdictiongroup (权限组), sftlogininfocustomergroup (客户查看), sftlogininfosupplygroup (供应商查看), sftlogininfopersongroup (人员查看), sftlogininfodrivergroup (司机查看) — it DELETEs all rows where sParentId=p_sToUserId then INSERTs a fresh copy from the source rows keyed on sParentId=p_sUserId, generating new sId via NewId().

Invocation: Dispatched dynamically by GenericProcedureCallServiceImpl.doGenericProcedureCall() (POST /procedureCall/doGenericProcedureCall) — 用户管理 grid's 权限复制 toolbar button names this proc as its action. Sibling: Sp_BtnEventCopyGroupJurisdiction (group-level copy of sysjurisdiction).

Flag: same loop-overwrite bug as the group variant — only the last (sUserId, sToUserId) pair is acted on; multi-row selections silently drop all but one.