Sp_UpdateAdd_Check.md 2.25 KB

Sp_UpdateAdd_Check (procedure)

修改,删除校验

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

Parameters

# Mode Name Type
1 IN sGuids varchar(255)
2 IN sTableName varchar(255)
3 IN sFormGuid varchar(100)
4 IN sLoginId varchar(255)
5 IN sBrId varchar(255)
6 IN sSuId varchar(255)
7 IN sType varchar(255)
8 IN iFlag int
9 OUT sCode int
10 OUT sReturn varchar(255)

Body

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

Narrative

Business context: Cross-cutting save/delete guard (修改,删除校验) — invoked from the BACK before a record is updated or deleted to verify the operation is allowed: master/slave table resolution, row-existence, audit-state, lock-table conflicts, special form exclusions. Returns sCode<0 to halt the caller's transaction with sReturn as the user-facing reason.

What it does: Short-circuits when sTableName starts with gds (backend tables), is accexpenseentryworkcenterslave, mftproductionplanbillslave, or sFormGuid is one of two whitelist forms (192116811124916399633266060, 1691254111217047895126140). For sysmsg it marks sysmsguser.bIsView=1 for the current user. Otherwise calls Sp_GetMasterSlave(sTableName, …) to resolve master/slave names and the delete-key column, then runs the per-row check loop — guards include audit (bCheck=1), maker-only edits, child existence, and lock-table entries.

Invocation: Two Java callers (real). BusinessCheckServiceImpl.checkUpdateDel(...) packages the params into searMap, runs getDoProMap and getCallProByMap to invoke Sp_UpdateAdd_Check, and throws CustomException(sReturn) when sCode<0. BusinessBaseServiceImpl.addSysLocking(...) invokes the same path during the "click modify button" lock-acquisition flow — see its 校验Sp_UpdateAdd_Check过程调用 comment. Also called by Sp_DelMasterSlave_Pro and Sp_DelMasterSlave_Pro2 as the pre-delete guard before they call Sp_delete_backwriting. xly-src ships script/标版/30100101/Sp_UpdateAdd_Check.sql.