# `sp_get_salsal_order` (procedure)

> 测试电商接口数据源过程


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sBrId` | `varchar(100)` |
| 2 | IN | `sSuId` | `varchar(100)` |
| 3 | IN | `sBody` | `longtext` |
| 4 | OUT | `sCode` | `int` |
| 5 | OUT | `sReturn` | `longtext` |
| 6 | OUT | `sParam` | `longtext` |

## Body

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

## Narrative

**Business context:** Header banner `测试电商接口数据源过程` — a worked sample for the 电商接口 (e-commerce integration) framework, demonstrating the data-source procedure shape that external callers wire into 自定义接口. Returns rows from `salsalesordermaster` for a given sId. Per the inline `-- 温馨提示` comment, the body is left as a copy-from template for developers to clone.

**What it does:** Normalises `sBrId/sSuId/sCode/sReturn` defaults (`sCode=1`, `sReturn='操作成功'`, `sReturn` codes: -1 fail, 1 ok, 2 ok-no-call, 3 ok-no-call-but-run-post). Validates `sBody` is JSON (`JSON_VALID(sBody)=1`) and inside the `top:`/`sBody:` nested labels extracts `p_sId` from `$.sId`. Then `SELECT * FROM salsalesordermaster WHERE sId = p_sId AND sBrandsId = sBrId AND sSubsidiaryId = sSuId` — returning the order master row as the procedure's resultset.

**Invocation:** Status: appears orphaned. No caller found in any channel — no `gdsmodule` hook, no `gdsconfigformmaster` reference, no other proc CALLs it, no xly-src grep hit. The "测试" label and the `-- 温馨提示` (developer hint) block in the body confirm this is a sample/template, not a live endpoint. Production interface procs follow the same shape but are registered elsewhere.
