# `Sp_BtnRepair_UpdateCustomer` (procedure)

> 变更主表数据


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sProInParam` | `varchar(10000)` |
| 2 | IN | `sMakePerson` | `varchar(100)` |
| 3 | IN | `sUserId` | `varchar(100)` |
| 4 | IN | `sBrId` | `varchar(100)` |
| 5 | IN | `sSuId` | `varchar(100)` |
| 6 | OUT | `sReturn` | `varchar(1000)` |
| 7 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 客户档案 / 变更主表数据 — bulk "批量修改" dialog handler for the 客户 (customer) master grid. Lets a sales-admin overwrite a curated set of customer-profile fields (name, short name, salesman, merchandiser, contacts, address, etc.) across many rows in one click.

**What it does:** Parses `$.params[*].value[*].sId` and per-field values from `$.changeValue` (`sCustomerName`, `sCustomerShort`, `sStorePerson`, `sSalesManId`, `bMoreOut`, `sParentId`, `sCustomerPropertyId`, `sMerchandiserId`, `sSrcCustomerId`, `sContacts`, `sMobile`, `sPhone1`, `sCompanyAddress`). For each `sId`, executes `UPDATE elecustomer A SET ...` using `IF(IFNULL(p_x,'')='',A.x,p_x)` per field so blank changeValue entries are skipped — only `bMoreOut` and `sSrcCustomerId` are overwritten unconditionally.

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` (POST `/procedureCall/doGenericProcedureCall`) — front-end "批量修改" dialog on the 客户档案 grid registers this procedure name. Built from the `sButtonParam.sql` template. Sibling of the `Sp_BtnRepair_Update*` family.
