chore: sync local project changes

This commit is contained in:
Shen Wei
2026-04-28 16:39:21 +08:00
parent 365caa800a
commit e4cf7f8485
27 changed files with 13691 additions and 1317 deletions

View File

@@ -499,20 +499,20 @@ CREATE INDEX idx_enum_labels_domain ON enum_labels(domain, sort_order);
| domain | 说明 | 对应表字段 |
|--------|------|-----------|
| `client.status` | 客源状态(7 态) | `clients.status` |
| `client.status` | 客源状态(8 态) | `clients.status` |
| `client.grade` | 客源等级5 档 + E | `clients.grade` |
| `client.purpose_type` | 需求类型 | `client_requirements.purpose_type` |
| `client.usage` | 房源用途偏好 | `client_requirements.usage` |
| `client.requirement_type` | 需求类型(旧:`client.purpose_type` | `client_requirements.requirement_type` |
| `client.property_usage` | 房源用途偏好(旧:`client.usage` | `client_requirements.property_usage` |
| `client.orientation` | 朝向偏好 | `client_requirements.orientation` |
| `client.payment_method` | 付款方式 | `clients.payment_method` |
| `property.status` | 房源状态 | `properties.status` |
| `property.attribute` | 房源属性(公/私/保护) | `properties.attribute` |
| `property.usage` | 房源用途 | `properties.usage` |
| `property.property_type` | 房源类型(旧:`property.usage` | `properties.property_type` |
| `property.grade` | 房源等级5 档) | `properties.grade` |
| `property.listing_type` | 挂牌类型 | `properties.listing_type` |
| `property.listing_history.listing_type` | 挂牌类型(旧:`property.listing_type` | `listing_histories.listing_type` |
| `property.decoration` | 装修程度 | `properties.decoration` |
| `property.orientation` | 朝向 | `properties.orientation` |
| `commission.type` | 委托类型 | `commissions.commission_type` |
| `property.commission.status` | 委托状态(旧:`commission.type` | `commissions.status` |
| `field_survey.status` | 实勘状态 | `field_surveys.status` |
| `follow_log.log_type` | 跟进日志类型 | `follow_logs.log_type` |

View File

@@ -70,7 +70,7 @@ Staff (员工)
| client_no | VARCHAR(30) | UNIQUE, NOT NULL | 系统生成的客源编号,格式由运营配置(如 KY20260424001 |
| client_type | VARCHAR(20) | NOT NULL DEFAULT 'private' | `private`=私客 / `public`=公客 / `transacted`=成交客 |
| status | VARCHAR(20) | NOT NULL DEFAULT 'buying' | 见下方枚举 |
| grade | VARCHAR(5) | NOT NULL DEFAULT 'C' | `A_urgent`=A急迫 / `A` / `B`=较强 / `C`=一般 / `D`=较弱 / `E`=暂不关注 |
| grade | VARCHAR(5) | NOT NULL DEFAULT 'C' | `A`=A急迫 / `B`=较强 / `C`=一般 / `D`=较弱 / `E`=暂不关注 |
| property_usage | VARCHAR(30) | NOT NULL DEFAULT 'residential' | `residential`=住宅 / `villa`=别墅 / `commercial_residential`=商住 / `shop`=商铺 / `office`=写字楼 / `other`=其他 |
| buying_purpose | VARCHAR(20)[] | | 购房目的多选:`rigid`=刚需 / `investment`=投资 / `school_district`=学区 / `upgrade`=改善 / `commercial`=商用 / `other`=其他 |
| payment_method | VARCHAR(30) | | `full`=全额 / `mortgage`=商业贷款 / `mortgage_fund`=商贷+公积金 / `fund`=公积金 |

View File

@@ -155,11 +155,10 @@
| 值 | 说明 |
|----|------|
| `A_urgent` | A急迫 |
| `A` | A |
| `A` | A急迫 |
| `B` | B较强 |
| `C` | C一般 |
| `D` | D |
| `D` | D(较弱) |
### follow_log.log_type跟进日志类型
@@ -263,7 +262,7 @@ CREATE TABLE properties (
-- ── 等级与标签 ──
grade VARCHAR(10)
CHECK (grade IN ('A_urgent','A','B','C','D')),
CHECK (grade IN ('A','B','C','D')),
-- ── 交易属性 ──
ownership_years VARCHAR(30), -- 房本年限不满2年/满2年/满5年 等

View File

@@ -3,10 +3,14 @@
# Fonrey — 统一枚举字典ENUMS
> **定位**:本文件是 Fonrey 全局枚举标准Public + Tenant的统一实现基线。
> **版本**v2.1
> **日期**2026-04-27
> **版本**v2.2
> **日期**2026-04-28
> **适用范围**`DATA_MODEL_PUBLIC.md`、`DATA_MODEL_LOGIN.md`、`DATA_MODEL_ORG.md`、`DATA_MODEL_COMPLEX.md`、`DATA_MODEL_PROPERTY.md`、`DATA_MODEL_CLIENT.md`、`DATA_MODEL_PERMISSION.md`、`DATA_MODEL_SETTING.md`
> **⚠️ 枚举值命名规范**:所有枚举值统一使用 **`lower_snake_case`**(全小写+下划线)。
> 历史遗留大写值(`SUCCESS`/`FAILED`、`BOOLEAN`/`SCOPE`/`INTEGER`、`REPLACE`/`RESTRICT`/`GRANT`、`A_urgent`/`A_app`/`B_schema`/`C_feature`)在 v2.2 中已统一迁移为小写。
> **DB `CHECK` 约束、`enum_labels` 种子数据、前端代码须同步更新为新值**;迁移脚本须包含历史数据 UPDATE。
---
## 一、枚举分层标准(必须遵守)
@@ -58,8 +62,8 @@ Fonrey 采用两层枚举体系:
### 2.3 平台审计与备份导出
**domain**: `public.platform_audit.result`
- `SUCCESS`:成功
- `FAILED`:失败
- `success`:成功
- `failed`:失败
**domain**: `public.backup_schedule.frequency`
- `hourly`:每小时
@@ -92,7 +96,7 @@ Fonrey 采用两层枚举体系:
**domain**: `public.export_task.status`
- `pending`:待执行
- `in_progress`:执行中
- `done`:已完成
- `success`:成功(语义等价原 `done`,与 `backup_record.status` 对齐)
- `failed`:失败
### 2.4 升级与发布Public
@@ -102,9 +106,9 @@ Fonrey 采用两层枚举体系:
- `rollback`:回滚
**domain**: `public.upgrade_event.upgrade_type`
- `A_app`A类应用升级
- `B_schema`B类数据库结构升级
- `C_feature`C类功能开关升级
- `app`A类-应用升级(原 `A_app`
- `schema`B类-数据库结构升级(原 `B_schema`
- `feature`C类-功能开关升级(原 `C_feature`
**domain**: `public.upgrade_event.strategy`
- `full`:全量发布
@@ -241,9 +245,9 @@ Fonrey 采用两层枚举体系:
- `recharge`:在线充值
**domain**: `permission.value_type`
- `BOOLEAN`:开关型
- `SCOPE`:范围型
- `INTEGER`:数值型
- `boolean`:开关型(原 `BOOLEAN`
- `scope`:范围型(原 `SCOPE`
- `integer`:数值型(原 `INTEGER`
**domain**: `permission.role_category`
- `agent`:置业顾问
@@ -262,9 +266,9 @@ Fonrey 采用两层枚举体系:
- `company`:全公司
**domain**: `permission.override_mode`
- `REPLACE`:覆盖
- `RESTRICT`:限制
- `GRANT`:授予
- `replace`:覆盖(原 `REPLACE`
- `restrict`:限制(原 `RESTRICT`
- `grant`:授予(原 `GRANT`
**domain**: `permission.data_scope_type`
- `self`:本人
@@ -394,11 +398,10 @@ Fonrey 采用两层枚举体系:
- `inconvenient`:不便看房
**domain**: `property.grade`
- `A_urgent`A急迫
- `A`A
- `B`B较强
- `C`C一般
- `D`D较弱
- `a`A急迫
- `b`B较强
- `c`C一般
- `d`D较弱
**domain**: `property.contact.gender`
- `male`:先生
@@ -519,6 +522,21 @@ Fonrey 采用两层枚举体系:
- `public`:公客
- `invalid`:无效
> **⚠️ 合法组合约束**`client_type` × `client.status`
> `client_type` 表示客源的"身份类别"`status` 表示客源的"当前业务状态",两者是不同维度。
> 合法组合矩阵如下:
>
> | `client_type` | 允许的 `status` 值 | 禁止的 `status` 值 |
> |---|---|---|
> | `private`(私客) | `buying` / `renting` / `buy_or_rent` / `suspended` / `invalid` | `public`、`bought`、`rented_done`(未成交不可用终态) |
> | `public`(公客) | `public` / `buying` / `renting` / `buy_or_rent` / `suspended` / `invalid` | `bought`、`rented_done` |
> | `transacted`(成交客) | `bought` / `rented_done` | 其他所有值(终态不可逆) |
>
> **实施要求**
> - 服务层(`ClientService`)在状态变更时必须校验组合合法性
> - DB 侧可用触发器或 `CHECK` 约束覆盖最关键禁止项(如 `transacted` + 非终态)
> - `private → public` 转换须调用专用方法 `transfer_to_public()`,同时修改 `client_type` 和 `status`
**domain**: `client.grade`
- `A`A急迫
- `B`B较强
@@ -697,7 +715,7 @@ Fonrey 采用两层枚举体系:
- `sale`:出售
- `rent`:出租
- `sale_rent`:租售
- `*`:全部
- `all`:全部(原设计为 `*`,因 SQL/URL/权限表达式通配误解风险已统一改为 `all`DB CHECK 约束、前端筛选器须同步)
**domain**: `setting.field_rule.requirement`
- `required`:必填