# `Fun_Exclusion_algorithm` (function)

> 获取排除算法


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sProductTypeId` | `varchar(100)` |

## Body

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

## Narrative

**Business context:** Box-typesetting (拼版) layout configuration helper for the imposition / nesting (`sisboxtypesetting`) feature. For a given product-type id, returns the type's child layout rules as a JSON array — each rule packed as `{iIncrement, sId, sBrandsId, sSubsidiaryId, iOrder, sParentId, sName, sChinese, showName, sBig5, iFitWidth, sCode, sSettingMethod, iFAngle, sFLengthOffset/sFWidthOffset, iSAngle, sSLengthOffset/sSWidthOffset, sSGroupOffset, sSecondLongitudinalOffset/sSecondorizontalOffset}`. Header comment is `获取排除算法` ("get exclusion algorithm").

**What it does:** runs one `SELECT` against `sisboxtypesetting` filtered by `sParentId = sProductTypeId`, builds each row's JSON via `JSON_OBJECT`, joins them with `GROUP_CONCAT ORDER BY iOrder`, and wraps the result in `[...]`. Returns the empty string when no rows match.

**Invocation:** Status: appears orphaned. No caller found in any channel (form-master sSqlStr, gdsmodule hooks, other routines, exhaustive xly-src grep, dynamic-dispatch search) — candidate for maintainer audit.
