# `Sp_addBtn_gdsmodle` (procedure)

> 新增按钮


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

## Parameters

_No parameters._

## Body

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

## Narrative

**Business context:** One-shot DBA / install-time helper. Header says 新增按钮 ("add buttons"). Retrofits the standard toolbar button row (BtnAdd / BtnUpd / BtnDel / BtnBsOperation.BtnInvalid / BtnExamine / BtnOut / BtnRefresh / BtnSave / BtnCancel / BtnCancelExamine) onto the primary form of every `gdsmodule` row whose `sDisplayType='Business'`, so newly created Business modules get the full button set without the dev having to wire 10 `gdsconfigformslave` rows by hand.

**What it does:** Cursors over `gdsmodule WHERE sName <> '' AND sDisplayType ='Business'`; for each, picks the `gdsconfigformmaster` child (or, if multiple, the one with `bGrd=0` ordered by `iOrder`); runs 10 `INSERT … SELECT … FROM DUAL WHERE NOT EXISTS (…)` blocks — one per standard `sControlName` — into `gdsconfigformslave` under that form, hard-coding tenant `sBrandsId='1111111111'` / `sSubsidiaryId='1111111111'`.

**Invocation:** Status: appears orphaned. No caller found in any channel (form-master, gdsmodule hooks, other routines, xly-src grep) — candidate for maintainer audit. The proc is idempotent (every INSERT is guarded by `NOT EXISTS`), so it's safe to run manually as a one-shot retrofit; the standard new-module flow today seeds buttons through a different path.

Caveats: hardcoded tenant GUID `'1111111111'` makes this single-tenant only; the 审核 (BtnExamine) `NOT EXISTS` guard checks `sControlName='BtnBsOperation.BtnInvalid'` instead of `BtnExamine` — copy-paste bug that lets BtnExamine be inserted twice or skipped depending on the order of prior runs.
