我有这个“食物”数组:
"food": [
{
"id": 11,
"name": "Kabeljaufilet",
"preis": 3.55,
"art": "mit Fisch"
},
{
"id": 12,
"name": "Spaghetti Bolognese",
"preis": 3.85,
"art": "mit Fleisch"
},
{
"id": 13,
"name": "Pizza Salami",
"preis": 3.99,
"art": "mit Fleisch"
},
现在,我需要另一个名为“ foodplan”的数组,在这里可以从第一个数组添加,删除等食物。
我从未创建过实现另一个数组对象的数组。现在如何继续?
Foodplan 需要以下属性: FoodPerWeek ,其中有5个食物对象,WeekNumber Foodplan需要显示食物,添加食物,更改食物和删除食物的方法。
答案 0 :(得分:2)
这只是一个基本示例。 当然,您可以根据需要动态调整数组的大小。 需要进行一些检查以验证输入等。我将其留给您。玩得开心。
SELECT
SUM(collection_status = 'COLLECTED'),
SUM(collection_status = 'SCHEDULED'),
SUM(collection_status = 'CORRUPTED' ),
SUM(collection_status is NULL ),
SUM(((labeling_status = 'GOOD' and (upload_status != 'UPLOADED' or upload_status != 'QUEUED')) or (labeling_status = 'Labeled'))),
SUM((labeling_status = 'RAW') or (labeling_status = 'ASSIGNED') ),
SUM(labeling_status = 'RE-LABEL' ),
SUM((upload_status = 'UPLOADED' or upload_status = 'QUEUED')),
SUM(labeling_status = 'GOOD' and upload_status is null )
FROM test_status
WHERE project_id = 7