大家在用ORM获取列表的时候需要关联数据,需要对数据遍历格式化吗
比如需要关联设备表获取设备名称
模型关联
"process": {
"id": 1,
"name": "设备1"
},
需要遍历处理成"process_name":"设备1"吗
{
"code": 0,
"msg": "成功",
"data": {
"total": 6,
"page": 1,
"per_page": 10,
"pages": 1,
"list": [
{
"id": 6,
"type": 1,
"process_no": 1,
"batch_no": "11",
"num": 11,
"created_at": "2022-10-28T07:45:21.000000Z",
"process": {
"id": 1,
"name": "工序11"
},
"material_type": {
"id": 1,
"name": "物料11",
"no": "11",
"created_at": "2022-10-28T07:59:49.000000Z"
}
}
]
}
}
我觉得不需要 ,这个看你们团队要求
好的 多谢
返回对象 不好吗