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
}
GET /api/ingredient/select
keys=011101,011102,011103 // 根据ID检索, 两个查询条件2选一
keyword=01 // 查询关键字,模糊匹配用
{
"body": [
{
"key": "011101",
"name": "小麦",
"type": "谷薯类"
}
],
"code": 200,
"desc": "成功",
"success": true
}
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
}
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
}
DELETE /api/ingredient
Content-Type:application/x-www-form-urlencoded
keys=010101,0101012,0101013 // 必填
{
"code": 200,
"desc": "成功",
"success": true
}
PUT /api/ingredient/mark
Content-Type:application/x-www-form-urlencoded
key=010101 // 食材编号
mark=常用 // 必填, 取值: 常用/忌用
{
"code": 200,
"desc": "成功",
"success": true
}
DELETE /api/ingredient/mark
Content-Type:application/x-www-form-urlencoded
key=010101 // 食材编号
{
"code": 200,
"desc": "成功",
"success": true
}
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
GET /api/ingredient/excel