This commit is contained in:
xiezhijun
2021-02-23 15:36:23 +08:00
69 changed files with 5156 additions and 2200 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,23 +1,82 @@
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.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.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
private ISysRecipesService sysRecipesService;
/**
* 获取食谱详情
*
* @param resipesId
* @return
*/
@GetMapping(value = "/{resipesId}")
public AjaxResult getInfo(@PathVariable("resipesId") Long resipesId) {
return AjaxResult.success(sysRecipesService.selectSysRecipesByRecipesId(resipesId));
}
@Log(title = "食谱", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult addRecipes(@RequestBody SysRecipes sysRecipes) {
int rows = sysRecipesService.addRecipes(sysRecipes);
if (rows > 0) {
return AjaxResult.success(sysRecipes.getId());
} else {
return AjaxResult.error();
}
}
/**
* 修改食谱菜品
*
* @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));
}
}