Sp_Add_Flow (procedure)
插入流程
- Type: PROCEDURE
- Deterministic: NO
- SQL data access: CONTAINS SQL
Parameters
| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | sFormGuid |
varchar(100) |
| 2 | IN | sGuid |
varchar(100) |
| 3 | IN | sLoginId |
varchar(100) |
| 4 | IN | sModuleflowId |
varchar(100) |
| 5 | IN | sTableParams |
longtext |
| 6 | IN | sDoCallPro |
longtext |
| 7 | IN | sTableParamsValue |
longtext |
| 8 | OUT | sReturn |
varchar(4000) |
| 9 | OUT | sSrcReportData |
longtext |
| 10 | OUT | sFlowId |
varchar(100) |
| 11 | IN | sBrId |
varchar(100) |
| 12 | IN | sSuId |
varchar(100) |
| 13 | OUT | sCode |
int |
Body
Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpAdd_Flow'._
Narrative
Business context: Workflow engine — the canonical "submit-for-approval" entry point. Header says 插入流程 ("insert flow"). When a user clicks 审批 (Approve / submit-for-review) on any form that has a configured gdsmoduleflow row, this proc records the approval request as a biz_flow row carrying the source bill id, the form-defined column/value snapshot, the calc-proc name, and the do-call-proc payload — the workflow service then runs that flow asynchronously.
What it does: Looks up the flow definition from gdsmoduleflow by sModuleflowId (yielding sFlowType, sFlowTypeName, sReportId, sSrcFormId, sCalcProName, sMasterTableName, bReturnStart); resolves the form's primary slave-table id (p_sMaintableId) via gdsconfigformmaster; optionally rebuilds report-payload state from Sp_System_ReplaceField_JSON; generates sFlowId = newId(); INSERT INTO biz_flow with type/name/title/reason/start_time/apply-user/tenant fields and the caller-provided sTableParams/sTableParamsValue/sDoCallPro.
Invocation: Called by CheckExamineFlowDataServiceImpl.doSendCheckFolwData() via doProByNameFlow(..., "Sp_Add_Flow", ...), which is itself invoked from CheckExamineFlowServiceImpl.doSendCheckFolw() — the approval-submit service endpoint. 47+ Sp_Apply_Flow_* specialised pre-flow procs (one per business object: SalSaleOrder, MaterialsApply, QualityAccident*, ProcessChange, PurpurchaseOrder, etc.) reference this name; in the flow architecture they are the per-form calc-procs invoked alongside this proc.
Caveats: body contains a stray SELECT ddd FROM bbbb; (~line 108) that looks like leftover debug — this would error at runtime unless the table exists; flag for maintainer audit. Also the version under script/标版/upgrade/定时器/Sp_Add_Flow.sql and flyway/V1.0.7__202354_SpAddFlow.sql / V2.0.10__2023915_SpAddFlow.sql are install/upgrade artefacts — the live version is whichever Flyway version migrated last.