生成食谱接口对接
This commit is contained in:
		| @@ -4,7 +4,8 @@ import com.stdiet.common.annotation.Log; | ||||
| import com.stdiet.common.core.controller.BaseController; | ||||
| import com.stdiet.common.core.domain.AjaxResult; | ||||
| import com.stdiet.common.enums.BusinessType; | ||||
| import com.stdiet.custom.domain.SysDishes; | ||||
| import com.stdiet.custom.domain.SysRecipes; | ||||
| import com.stdiet.custom.domain.SysRecipesDailyDishes; | ||||
| import com.stdiet.custom.service.ISysRecipesService; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
| @@ -16,36 +17,66 @@ public class SysRecipesController extends BaseController { | ||||
|     @Autowired | ||||
|     private ISysRecipesService sysRecipesService; | ||||
|  | ||||
|     /** | ||||
|      * 获取食谱详情 | ||||
|      * | ||||
|      * @param resipesId | ||||
|      * @return | ||||
|      */ | ||||
|     @GetMapping(value = "/{resipesId}") | ||||
|     public AjaxResult getInfo(@PathVariable("resipesId") Long resipesId) { | ||||
|         return AjaxResult.success(sysRecipesService.selectSysRecipesByRecipesId(resipesId)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 修改食谱菜品 | ||||
|      * | ||||
|      * @return | ||||
|      */ | ||||
|     @Log(title = "食谱", businessType = BusinessType.UPDATE) | ||||
|     @PutMapping | ||||
|     public AjaxResult edit(@RequestBody SysDishes sysDishes) { | ||||
|         return toAjax(sysRecipesService.updateDishesDetail(sysDishes)); | ||||
|     } | ||||
|  | ||||
|     @Log(title = "食谱", businessType = BusinessType.INSERT) | ||||
|     @PostMapping | ||||
|     public AjaxResult add(@RequestBody SysDishes sysDishes) { | ||||
|         int rows = sysRecipesService.insertDishes(sysDishes); | ||||
|     public AjaxResult addRecipes(@RequestBody SysRecipes sysRecipes) { | ||||
|         int rows = sysRecipesService.addRecipes(sysRecipes); | ||||
|         if (rows > 0) { | ||||
|             return AjaxResult.success(sysDishes.getId()); | ||||
|             return AjaxResult.success(sysRecipes.getId()); | ||||
|         } else { | ||||
|             return AjaxResult.error(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Log(title = "销售订单", businessType = BusinessType.DELETE) | ||||
|     @DeleteMapping("/dishes/{cId}") | ||||
|     public AjaxResult delete(@PathVariable Long cId) { | ||||
|         return toAjax(sysRecipesService.deleteDishes(cId)); | ||||
|     /** | ||||
|      * 修改食谱菜品 | ||||
|      * | ||||
|      * @param sysRecipesDailyDishes | ||||
|      * @return | ||||
|      */ | ||||
|     @Log(title = "食谱菜品", businessType = BusinessType.UPDATE) | ||||
|     @PutMapping(value = "/dishes") | ||||
|     public AjaxResult edit(@RequestBody SysRecipesDailyDishes sysRecipesDailyDishes) { | ||||
|         return toAjax(sysRecipesService.updateDishesDetail(sysRecipesDailyDishes)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 添加菜品 | ||||
|      * | ||||
|      * @param sysRecipesDailyDishes | ||||
|      * @return | ||||
|      */ | ||||
|     @Log(title = "食谱菜品", businessType = BusinessType.INSERT) | ||||
|     @PostMapping(value = "/dishes") | ||||
|     public AjaxResult add(@RequestBody SysRecipesDailyDishes sysRecipesDailyDishes) { | ||||
|         int rows = sysRecipesService.addDishes(sysRecipesDailyDishes); | ||||
|         if (rows > 0) { | ||||
|             return AjaxResult.success(sysRecipesDailyDishes.getId()); | ||||
|         } else { | ||||
|             return AjaxResult.error(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 删除菜品 | ||||
|      * | ||||
|      * @param id | ||||
|      * @return | ||||
|      */ | ||||
|     @Log(title = "食谱菜品", businessType = BusinessType.DELETE) | ||||
|     @DeleteMapping("/dishes/{id}") | ||||
|     public AjaxResult delete(@PathVariable Long id) { | ||||
|         return toAjax(sysRecipesService.deleteDishes(id)); | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user