Browse Source

更新文档

main
kkerwin 2 years ago
parent
commit
072b0cfb72
  1. 12
      doc/ingredient.md
  2. 269
      doc/nutrition.md

12
doc/ingredient.md

@ -9,9 +9,9 @@
```
pageSize=20 // 默认20, 全部非必填
pageNo=0 // 默认0, 从0开始
keyword=01 // 查询关键字,模糊匹配用
type=谷薯类 // 食材类型
mark=常用 // 食材标记. 业务端用标记,管理端没用
keyword=01 // 查询关键字
```
### 输出:
@ -97,7 +97,7 @@ nutrient={"fat": 10, "energy": 10, "calcium": 12, "protein": 15, "vitamin-a": 23
### 输入:
```
Content-Type:application/x-www-form-urlencoded
nutrients=010101,020202,030303 // 必填
ingredients=010101,0101012,0101013 // 必填
```
@ -117,7 +117,7 @@ nutrients=010101,020202,030303 // 必填
### 输入:
```
Content-Type:application/x-www-form-urlencoded
nutrient=010101
ingredient=010101 // 食材编号
mark=常用 // 必填, 取值: 常用/忌用
```
@ -138,7 +138,7 @@ mark=常用 // 必填, 取值: 常用/忌用
### 输入:
```
Content-Type:application/x-www-form-urlencoded
nutrient=010101
ingredient=010101 // 食材编号
```
@ -151,9 +151,9 @@ nutrient=010101
}
```
# 7. 批量导入(管理端接口)
# 7. 批量导入(管理端接口, 暂不可用)
> PUT /api/ingredient/mark
> PUT /api/ingredient/upload
### 输入:
```

269
doc/nutrition.md

@ -0,0 +1,269 @@
# 营养计划部分
# 1. 查询计划(根据名字模糊查询)
> GET /api/nutrition
### 输入:
```
pageSize=20 // 默认20, 全部非必填
pageNo=0 // 默认0, 从0开始
keyword=青少年 // 查询关键字
```
### 输出:
```
{
"body": {
"content": [
{
"foodCategoryDay": {
"水果类": 20,
"蔬菜类": 50,
"谷薯类": 10,
"畜肉禽类": 30
},
"foodCategoryWeek": {
"水果类": 100,
"蔬菜类": 200,
"谷薯类": 500,
"畜肉禽类": 300
},
"id": 1,
"ingredient": {
"轻体力": {
"vitamin-a": {
"min": 2,
"max": 10,
"ul": 5
}
},
"中体力": {
"vitamin-a": {
"min": 2,
"max": 10,
"ul": 5
}
}
},
"name": "青少年就餐指导",
"overflow": 0.51,
"vendors": [
1
]
}
],
"number": 0,
"size": 20,
"totalElements": 1,
"totalPages": 1
},
"code": 200,
"desc": "成功",
"success": true
}
```
# 2. 查询计划(根据ID/NAME精确查询)
> GET /api/nutrition
### 输入:
```
id=1 // 两个查询参数二选一
name=青少年计划 // 两个查询参数二选一
```
### 输出:
```
{
"body": {
"foodCategoryDay": {
"水果类": 20,
"蔬菜类": 50,
"谷薯类": 10,
"畜肉禽类": 30
},
"foodCategoryWeek": {
"水果类": 100,
"蔬菜类": 200,
"谷薯类": 500,
"畜肉禽类": 300
},
"id": 1,
"ingredient": {
"轻体力": {
"vitamin-a": {
"min": 2,
"max": 10,
"ul": 5
}
},
"中体力": {
"vitamin-a": {
"min": 2,
"max": 10,
"ul": 5
}
}
},
"name": "青少年就餐指导",
"overflow": 0.51,
"vendors": [
1
]
},
"code": 200,
"desc": "成功",
"success": true
}
```
# 3. 查询计划(根据商家查询)
> GET /api/nutrition
### 输入:
```
vender=1 // 必填
```
### 输出:
```
{
"body": [
{
"key": 1,
"value": "青少年就餐指导"
}
],
"code": 200,
"desc": "成功",
"success": true
}
```
# 4. 添加计划(管理端接口)
> PUT /api/nutrition
### 输入:
```
Content-Type:application/x-www-form-urlencoded
name=青少年就餐指导 // 必填 名称
vendors=1,2.3 // 必填 单位列表
overflow=0.5 // 必填 溢出
```
### 输出:
```
{
"code": 200,
"desc": "成功",
"success": true
}
```
# 5. 修改计划(管理端接口)
> POST /api/nutrition
### 输入:
```
Content-Type:application/x-www-form-urlencoded
id=1 // 必填
name=青少年就餐指导 // 名称
vendors=1,2.3 // 单位列表
overflow=0.5 // 溢出
foodCategoryDay={"水果类": 20, "蔬菜类": 50, "谷薯类": 10, "畜肉禽类": 30}
foodCategoryWeek={"水果类": 200, "蔬菜类": 500, "谷薯类": 100, "畜肉禽类": 300}
ingredient={"中体力": {"vitamin-a": {"ul": 5, "max": 10, "min": 2}}, "轻体力": {"vitamin-a": {"ul": 5, "max": 10, "min": 2}}}
```
### 输出:
```
{
"code": 200,
"desc": "成功",
"success": true
}
```
# 6. 删除计划(管理端接口)
> DELETE /api/nutrition
### 输入:
```
Content-Type:application/x-www-form-urlencoded
id=1 // 必填
```
### 输出:
```
{
"code": 200,
"desc": "成功",
"success": true
}
```
# 5. 食材打标(业务端接口)
> PUT /api/ingredient/mark
### 输入:
```
Content-Type:application/x-www-form-urlencoded
nutrient=010101
mark=常用 // 必填, 取值: 常用/忌用
```
### 输出:
```
{
"code": 200,
"desc": "成功",
"success": true
}
```
# 6. 取消打标(业务端接口)
> DELETE /api/ingredient/mark
### 输入:
```
Content-Type:application/x-www-form-urlencoded
nutrient=010101
```
### 输出:
```
{
"code": 200,
"desc": "成功",
"success": true
}
```
# 7. 批量导入(管理端接口)
> PUT /api/ingredient/mark
### 输入:
```
Content-Type: multipart/form-data
files // 必传
```
### 输出:
```
{
"code": 200,
"desc": "成功",
"success": true
}
```
Loading…
Cancel
Save