# `Fun_GetLoginUserName` (function)

> 获取客户查看权限


- **Type:** FUNCTION
- **Returns:** `longtext`
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sLogin_id` | `varchar(255)` |
| 2 | IN | `sBr_id` | `varchar(255)` |
| 3 | IN | `sSu_id` | `varchar(255)` |

## Body

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

## Narrative

**Business context:** Login-display-name resolver — the inverse of `Fun_GetLoginUser`. Given a username or user sId, returns the human-readable `sUserName` from `sftlogininfo`, scoped to a `(sBrandsId, sSubsidiaryId)` tenant. Used by the workflow/check-flow procs to render reviewer names in approval-history strings and notification messages.

**What it does:** `SELECT sUserName INTO p_sReturn FROM sftlogininfo WHERE sBrandsId = … AND sSubsidiaryId = … AND (sUserName = sLogin_id OR sId = sLogin_id) LIMIT 1`.

**Invocation:** called from `Sp_Bill_Used`, `sp_get_unTodo`, `sp_get_unTodo_Apply`, `Sp_Quotion_CheckFlow_BH1`, `SP_Return_Flow`, `Sp_System_CheckFlow` — every place where an approver/reviewer id needs to be expanded to a display name for notification or audit text (e.g., `GROUP_CONCAT(Fun_GetLoginUserName(U.sUserId, …))`).
