Sp_BtnEventCopyGroupJurisdiction.md 1.86 KB

Sp_BtnEventCopyGroupJurisdiction (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 varchar(1000)
6 OUT sCode int

Body

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

Narrative

Business context: 系统权限 / 权限组 — toolbar handler that copies all sysjurisdiction permission rows from a source 权限组 (sGroupId) to a target group (sToGroupId) within the same brand/subsidiary. Used by admins to clone a freshly-built role definition onto a sibling group.

What it does: Parses the last entry from $.params[*].value[*] (the loop overwrites variables — only the final pair sticks) to get sGroupId and sToGroupId. Returns sCode=-1, chooseData (via Fun_Sis_GetConstNew) if sProInParam is not valid JSON. Then DELETEs every sysjurisdiction row keyed on (sToGroupId, sBrId, sSuId), and INSERTs a fresh copy from the source group with NewId() and current operator/timestamp.

Invocation: Dispatched dynamically by GenericProcedureCallServiceImpl.doGenericProcedureCall() (POST /procedureCall/doGenericProcedureCall) — 权限组 admin grid's 权限复制 toolbar button names this proc as its action. Sibling: Sp_BtnEventCopyUserJurisdiction (user-level copy across multiple permission tables).

Flag: the parsing WHILE loop overwrites p_sGroupId/p_sToGroupId on every iteration and p_iTmp is never incremented within the inner reads, so only the last pair is acted on. Multi-row selections silently lose all but one.