菜品增删查改对接

This commit is contained in:
huangdeliang
2021-02-20 19:46:13 +08:00
parent 854171897d
commit a7ca979d06
14 changed files with 251 additions and 26 deletions

View File

@ -148,6 +148,7 @@ mybatis:
mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml
typeHandlersPackage: com.stdiet.**.typehandler
# PageHelper分页插件
pagehelper:

View File

@ -148,6 +148,7 @@ mybatis:
mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml
typeHandlersPackage: com.stdiet.**.typehandler
# PageHelper分页插件
pagehelper:

View File

@ -148,6 +148,7 @@ mybatis:
mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml
typeHandlersPackage: com.stdiet.**.typehandler
# PageHelper分页插件
pagehelper:

View File

@ -1,16 +1,16 @@
package com.stdiet.web.controller.custom;
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.service.ISysRecipesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/recipes")
@RequestMapping("/custom/recipes")
public class SysRecipesController extends BaseController {
@Autowired
@ -20,4 +20,32 @@ public class SysRecipesController extends BaseController {
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);
if (rows > 0) {
return AjaxResult.success(sysDishes.getId());
} else {
return AjaxResult.error();
}
}
@Log(title = "销售订单", businessType = BusinessType.DELETE)
@DeleteMapping("/dishes/{cId}")
public AjaxResult delete(@PathVariable Long cId) {
return toAjax(sysRecipesService.deleteDishes(cId));
}
}