# 菜品部分 # 1. 查询菜品(根据名字模糊查询) > GET /api/dish ### 输入: ```text pageSize=20 // 默认20, 全部非必填 pageNo=0 // 默认0, 从0开始 keyword=番茄鸡蛋汤 // 查询关键字 mark=汤类 // 标签 取值参照GET /api/basic/enum 接口中的 mark poly=蒸 // 烹饪手法 取值参照GET /api/basic/enum 接口中的 poly ``` ### 输出: ```json { "body": { "content": [ { "icon": "112342343.jpg", "id": 2, "ingredient": [ { "isMain": true, "key": "011101", "value": 500 } ], "marks": "主食", "poly": "蒸", "modify": 1695277128000, "month": [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 12 ], "name": "番茄炒鸡蛋", "vender": 4 } ], "number": 0, "size": 20, "totalElements": 2, "totalPages": 1 }, "code": 200, "desc": "成功", "success": true } ``` # 2. 查询菜品(根据ID精确查询) > GET /api/dish ### 输入: ```text id=1 ``` ### 输出: ```json { "icon": "data:image/png;base64,iVBORkJggg==", "id": 1, "ingredient": [ { "isMain": true, "key": "011101", "value": 500 } ], "marks": "汤类", "poly": "蒸", "month": [ 1, 3, 5, 7, 9, 12 ], "name": "番茄鸡蛋汤", "vender": 1 } ``` # 3. 根据名称模糊查询(用于食谱部分选择菜品) > GET /api/dish/select ### 输入: ```text keyword=婆 ``` ### 输出: ~~~json { "body": [ { "id": 25, "ingredient": [ { "key": "3355", "value": 22 }, { "key": "3378", "value": 111 } ], "marks": "面食", "poly": "蒸", "name": "麻婆豆腐" }, { "id": 24, "ingredient": [ { "isMain": false, "key": "3355", "value": 22 }, { "isMain": true, "key": "3378", "value": 111 } ], "marks": "面食", "poly": "蒸", "name": "麻婆豆腐" } ], "code": 200, "desc": "成功", "success": true } ~~~ # 4. 营养标签 > GET /api/dish/label ### 输入: ```text ids=1,2,3 // 传了ID返回指定标签,不传返回所有菜品的标签列表 ``` ### 输出: ```json { "body": [ { "component": [ { "name": "钙", "nutrition": "60.00(mg)", "nvr": "0.00%" }, { "name": "vitamin-a", "nutrition": "115.00(-)", "nvr": "-" }, { "name": "蛋白质", "nutrition": "75.00(g)", "nvr": "1.00%" }, { "name": "脂肪", "nutrition": "50.00(g)", "nvr": "1.00%" }, { "name": "能量kcal", "nutrition": "50.00(kcal)", "nvr": "0.00%" } ], "ingredients": [ "小麦" ], "name": "番茄炒鸡蛋" } ], "code": 200, "desc": "成功", "success": true } ``` # 5. 添加菜品 > PUT /api/dish ### 输入: ```text Content-Type:application/x-www-form-urlencoded name=番茄炒鸡蛋 // 必填 名称 vendors=1,2,3 // 单位列表, 管理端必填,业务端没用 icon= // 图片 month=1,2,3 //月份 mark=汤类 // 必填 标签 取值参照GET /api/basic/enum 接口中的 mark poly=蒸 // 必填 烹饪手法 取值参照GET /api/basic/enum 接口中的 poly ingredient=[{"key": "011101", "value": 500, "isMain": true}] // 食材列表 ``` ### 输出: ```json { "code": 200, "desc": "成功", "success": true } ``` # 6. 修改 > POST /api/dish ### 输入: ```text Content-Type:application/x-www-form-urlencoded id=1 // 必填 name=番茄炒鸡蛋 // 必填 名称 vendors=1,2,3 // 单位列表 icon= // 图片 month=1,2,3 // 月份 mark=汤类 // 标签 取值参照GET /api/basic/enum 接口中的 mark poly=蒸 // 必填 烹饪手法 取值参照GET /api/basic/enum 接口中的 poly ingredient=[{"key": "011101", "value": 500, "isMain": true}] // 食材列表 ``` ### 输出: ```json { "code": 200, "desc": "成功", "success": true } ``` # 7. 删除 > DELETE /api/dish ### 输入: Content-Type:application/x-www-form-urlencoded ids=9,10 // 必填 输出: ```text { "code": 200, "desc": "成功", "success": true } ```