You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
211 lines
3.5 KiB
211 lines
3.5 KiB
2 years ago
|
|
||
|
# 食材部分
|
||
|
|
||
|
# 1. 查询食材
|
||
|
|
||
|
> GET /api/ingredient
|
||
|
|
||
|
### 输入:
|
||
|
```
|
||
|
pageSize=20 // 默认20, 全部非必填
|
||
|
pageNo=0 // 默认0, 从0开始
|
||
|
keyword=01 // 查询关键字,模糊匹配用
|
||
|
type=谷薯类 // 食材类型
|
||
|
mark=常用 // 食材标记. 业务端用标记,管理端没用
|
||
|
```
|
||
|
|
||
|
### 输出:
|
||
|
```
|
||
|
{
|
||
|
"body": {
|
||
|
"content": [
|
||
|
{
|
||
|
"key": "011101",
|
||
|
"mark": "常用",
|
||
|
"name": "小麦",
|
||
|
"nutrient": {
|
||
|
"fat": 10,
|
||
|
"energy": 10,
|
||
|
"calcium": 12,
|
||
|
"protein": 15,
|
||
|
"vitamin-a": 23
|
||
|
},
|
||
|
"time": 1693759354000,
|
||
|
"type": "谷薯类"
|
||
|
}
|
||
|
],
|
||
|
"number": 0,
|
||
|
"size": 20,
|
||
|
"totalElements": 1,
|
||
|
"totalPages": 1
|
||
|
},
|
||
|
"code": 200,
|
||
|
"desc": "成功",
|
||
|
"success": true
|
||
|
}
|
||
|
```
|
||
|
|
||
|
# 2. 查询食材(根据ID批量查询)
|
||
|
|
||
|
> GET /api/ingredient/select
|
||
|
|
||
|
### 输入:
|
||
|
```
|
||
|
keys=011101,011102,011103 // 根据ID检索, 两个查询条件2选一
|
||
|
keyword=01 // 查询关键字,模糊匹配用
|
||
|
```
|
||
|
### 输出:
|
||
|
```
|
||
|
{
|
||
|
"body": [
|
||
|
{
|
||
|
"key": "011101",
|
||
|
"name": "小麦",
|
||
|
"type": "谷薯类"
|
||
|
}
|
||
|
],
|
||
|
"code": 200,
|
||
|
"desc": "成功",
|
||
|
"success": true
|
||
|
}
|
||
|
```
|
||
|
|
||
|
# 3. 添加食材(管理端接口)
|
||
|
|
||
|
> PUT /api/ingredient
|
||
|
|
||
|
### 输入:
|
||
|
```
|
||
|
Content-Type:application/x-www-form-urlencoded
|
||
|
key=010101 // 必填
|
||
|
name=测试食材 // 必填
|
||
|
type=粗粮 // 必填 全部必填 取值范围见(/api/basic/enum) category
|
||
|
nutrient={"fat": 10, "energy": 10, "calcium": 12, "protein": 15, "vitamin-a": 23}
|
||
|
// 必填 取值范围见(/api/basic/enum) nutrient
|
||
|
```
|
||
|
|
||
|
### 输出:
|
||
|
```
|
||
|
{
|
||
|
"code": 200,
|
||
|
"desc": "成功",
|
||
|
"success": true
|
||
|
}
|
||
|
```
|
||
|
|
||
|
# 4. 修改食材(管理端接口)
|
||
|
|
||
|
> POST /api/ingredient
|
||
|
|
||
|
### 输入:
|
||
|
```
|
||
|
Content-Type:application/x-www-form-urlencoded
|
||
|
key=010101 // 必填
|
||
|
name=测试食材
|
||
|
type=粗粮
|
||
|
nutrient={"fat": 10, "energy": 10, "calcium": 12, "protein": 15, "vitamin-a": 23}
|
||
|
|
||
|
```
|
||
|
|
||
|
### 输出:
|
||
|
```
|
||
|
{
|
||
|
"code": 200,
|
||
|
"desc": "成功",
|
||
|
"success": true
|
||
|
}
|
||
|
```
|
||
|
# 5. 删除食材(管理端接口)
|
||
|
|
||
|
> DELETE /api/ingredient
|
||
|
|
||
|
### 输入:
|
||
|
```
|
||
|
Content-Type:application/x-www-form-urlencoded
|
||
|
keys=010101,0101012,0101013 // 必填
|
||
|
|
||
|
```
|
||
|
|
||
|
### 输出:
|
||
|
```
|
||
|
{
|
||
|
"code": 200,
|
||
|
"desc": "成功",
|
||
|
"success": true
|
||
|
}
|
||
|
```
|
||
|
|
||
|
# 6. 食材打标(业务端接口)
|
||
|
|
||
|
> PUT /api/ingredient/mark
|
||
|
|
||
|
### 输入:
|
||
|
```
|
||
|
Content-Type:application/x-www-form-urlencoded
|
||
|
key=010101 // 食材编号
|
||
|
mark=常用 // 必填, 取值: 常用/忌用
|
||
|
|
||
|
```
|
||
|
|
||
|
### 输出:
|
||
|
```
|
||
|
{
|
||
|
"code": 200,
|
||
|
"desc": "成功",
|
||
|
"success": true
|
||
|
}
|
||
|
```
|
||
|
|
||
|
# 7. 取消打标(业务端接口)
|
||
|
|
||
|
> DELETE /api/ingredient/mark
|
||
|
|
||
|
### 输入:
|
||
|
```
|
||
|
Content-Type:application/x-www-form-urlencoded
|
||
|
key=010101 // 食材编号
|
||
|
|
||
|
```
|
||
|
|
||
|
### 输出:
|
||
|
```
|
||
|
{
|
||
|
"code": 200,
|
||
|
"desc": "成功",
|
||
|
"success": true
|
||
|
}
|
||
|
```
|
||
|
|
||
|
# 8. 批量导入(管理端接口)
|
||
|
|
||
|
> PUT http://localhost:9527/api/ingredient/excel
|
||
|
|
||
|
### 输入:
|
||
|
```
|
||
|
Content-Type: multipart/form-data; boundary=boundary
|
||
|
|
||
|
--boundary
|
||
|
Content-Disposition: form-data; name="file"; filename="a.xlsx"
|
||
|
|
||
|
< C:\Users\CCC\Documents\WeChat Files\wxid_40aqnb839lkd12\FileStorage\File\2023-09\谷物及制品.xlsx
|
||
|
|
||
|
--boundary
|
||
|
Content-Disposition: form-data; name="extraInfo";
|
||
|
```
|
||
|
|
||
|
### 输出:
|
||
|
```
|
||
|
Content-Disposition: attachment;filename*=utf-8''%5B%E5%AF%BC%E5%85%A5%E7%BB%93%E6%9E%9C%5Da.xlsx
|
||
|
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
|
||
|
Transfer-Encoding: chunked
|
||
|
Date: Sun, 17 Sep 2023 18:49:10 GMT
|
||
|
Keep-Alive: timeout=60
|
||
|
Connection: keep-alive
|
||
|
|
||
|
Response file saved.
|
||
|
> [导入结果]a-2.xlsx
|
||
|
```
|
||
|
|
||
|
# 9.下载导入模板
|
||
|
|
||
|
> GET /api/ingredient/excel
|