【发布时间】:2021-10-24 11:55:16
【问题描述】:
我正在向用户显示一些数据:
{
"id": 3,
"name": "AB:11",
"description": "AB:11 is an Imperial Black Barley Wine brewed with ginger, black raspberries and chipotle peppers. A 12.8% rollercoaster of ginger zestiness and chipotle smokiness, all bound together with dark berry tartness and the decadent residual body of a Black Barley Wine.",
"method": {
"id": 3,
"mash_temp": [
{
"id": 6,
"temp": {
"value": 68,
"unit": "celsius"
}
}
]
}
}
但是,我想在没有“方法”的情况下显示它我只需要显示“mesh_temp”字段中的内容,所以它会是这样的:
"id": 3,
"name": "AB:11",
"description": "AB:11 is an Imperial Black Barley Wine brewed with ginger, black raspberries and chipotle peppers. A 12.8% rollercoaster of ginger zestiness and chipotle smokiness, all bound together with dark berry tartness and the decadent residual body of a Black Barley Wine.",
"mash_temp": [
{
"temp": {
"value": 68,
"unit": "celsius"
}
}
]
}
另外,就像您在第一个示例中看到的那样,我不想显示 mesh_temp 的 id
这些是我的实体:
- 啤酒:Beer class
- 方法:Method class
- 醪液温度:MashTemp class
- 温度:Temp class
总结一下:我只想显示:id、name、description 和 mash_temp 字段(没有 id)。任何建议如何做到这一点?
【问题讨论】:
标签: spring-boot hibernate rest