# `deleteMesg` (procedure)


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sGuid` | `varchar(100)` |
| 2 | IN | `sBrId` | `varchar(100)` |
| 3 | IN | `sSuId` | `varchar(100)` |

## Body

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

## Narrative

**Business context:** 系统消息 / 审批消息 — when a bill is hard-deleted, its in-app inbox notifications and approval-result trail need to disappear too. This routine removes the message + recipient + check-result rows for one (`sBillId`, `sBrandsId`, `sSubsidiaryId`) tuple.

**What it does:** Deletes from `sysbillcheckresult`, `sysmsguser`, and `sysMsg` in child-first order, scoped by `sMsgId/sParentId IN (SELECT sId FROM sysMsg WHERE sBillId = sGuid AND sBrandsId = sBrId AND sSubsidiaryId = sSuId)`. An earlier guarded-by-`sCheckStatus` variant is commented out, so this version is unconditional.

**Invocation:** Status: appears orphaned. No caller found in any channel — no form-master sSqlStr, no gdsmodule hook, no other routine references it, and no xly-src match. Candidate for maintainer audit; the live message-cleanup path is most likely inlined inside the bill-delete workflow procedures rather than going through this helper.
