forked from erp-dev/erp
feat: mdy staging api filters
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
- **只读**:仅提供 `list/retrieve`(不支持创建/更新/删除)
|
||||
- **分页**:LimitOffset(`limit` / `offset`)
|
||||
- **默认排序**:按 `ctime` 倒序(`-ctime`),并将 `ctime = null` 的记录排在最后
|
||||
- **过滤**:支持按明道云字段 `62d52f4b8d2972284492dd0e`(设计编号/订单id)精确匹配
|
||||
- **过滤**:支持按“内部字段名”的普通 query param 过滤(对前端隐藏 JSONField 实现细节)
|
||||
- **返回结构**:`raw` 与 `related` 两个 JSONField 在输出时会做“可读化/碾平”处理
|
||||
|
||||
### Endpoint
|
||||
@@ -23,12 +23,15 @@
|
||||
- **offset**:偏移量
|
||||
|
||||
#### 过滤
|
||||
- **raw__62d52f4b8d2972284492dd0e**:设计编号/订单id(精确匹配)
|
||||
- **design_no**:设计编号(精确匹配)
|
||||
- **style_name__icontains**:款号名称(模糊匹配)
|
||||
|
||||
> 该接口会拒绝任何以 `raw__` / `related__` 开头的参数(避免前端绕过白名单)。
|
||||
|
||||
示例:
|
||||
|
||||
```http
|
||||
GET /api/v1/mdy-plate-order-staging/?limit=20&offset=0&raw__62d52f4b8d2972284492dd0e=82724
|
||||
GET /api/v1/mdy-plate-order-staging/?limit=20&offset=0&design_no=82724
|
||||
```
|
||||
|
||||
### 默认排序规则
|
||||
@@ -43,7 +46,7 @@ GET /api/v1/mdy-plate-order-staging/?limit=20&offset=0&raw__62d52f4b8d2972284492
|
||||
- **ctime**:明道云系统字段 ctime(模型字段,便于排序)
|
||||
- **utime**:明道云系统字段 utime(模型字段)
|
||||
- **created_at / updated_at**:本地记录创建/更新时间(ModelBase)
|
||||
- **design_no**:便捷字段,等价于 `raw["62d52f4b8d2972284492dd0e"]`
|
||||
- **design_no**:便捷字段,等价于 `raw` 中的设计编号值
|
||||
- **raw**:对 `MDYPlateOrderStaging.raw` 的“可读化/碾平”输出
|
||||
- **related**:对 `MDYPlateOrderStaging.related` 的“碾平”输出(list[dict])
|
||||
|
||||
@@ -103,7 +106,7 @@ GET /api/v1/mdy-plate-order-staging/?limit=20&offset=0&raw__62d52f4b8d2972284492
|
||||
```
|
||||
|
||||
### 性能说明
|
||||
- 过滤字段 `raw__62d52f4b8d2972284492dd0e` 对应 PostgreSQL 表达式索引(见迁移 `api_v1/migrations/0006_mdy_plate_order_staging_raw_id_index.py`),用于加速按设计编号检索。
|
||||
- `design_no` 过滤对应 PostgreSQL 表达式索引(见迁移 `api_v1/migrations/0006_mdy_plate_order_staging_raw_id_index.py`),用于加速按设计编号检索。
|
||||
|
||||
### 实现位置
|
||||
- View/Serializer:`api_v1/views/mingdaoyun/plate_order_staging.py`
|
||||
|
||||
Reference in New Issue
Block a user