forked from Q-1515/reggie_parent
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
241 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
reggie_server/src/main/java/com/reggie/controller/user/CategoryController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.reggie.controller.user; | ||
|
||
import com.reggie.entity.Category; | ||
import com.reggie.result.R; | ||
import com.reggie.service.CategoryService; | ||
import io.swagger.annotations.Api; | ||
import io.swagger.annotations.ApiOperation; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import java.util.List; | ||
|
||
@RestController("userCategoryController") | ||
@RequestMapping("/user/category") | ||
@Api(tags = "C端-分类接口") | ||
public class CategoryController { | ||
|
||
@Autowired | ||
private CategoryService categoryService; | ||
|
||
/** | ||
* 查询分类 | ||
* @param type | ||
* @return | ||
*/ | ||
@GetMapping("/list") | ||
@ApiOperation("查询分类") | ||
public R<List<Category>> list(Integer type) { | ||
List<Category> list = categoryService.list(type); | ||
return R.success(list); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
reggie_server/src/main/java/com/reggie/controller/user/DishController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.reggie.controller.user; | ||
|
||
import com.reggie.entity.Dish; | ||
import com.reggie.result.R; | ||
import com.reggie.service.DishService; | ||
import com.reggie.vo.DishVO; | ||
import io.swagger.annotations.Api; | ||
import io.swagger.annotations.ApiOperation; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import java.util.List; | ||
|
||
@RestController("userDishController") | ||
@RequestMapping("/user/dish") | ||
@Slf4j | ||
@Api(tags = "C端-菜品浏览接口") | ||
public class DishController { | ||
@Autowired | ||
private DishService dishService; | ||
|
||
/** | ||
* 根据分类id查询菜品 | ||
* | ||
* @param categoryId | ||
* @return | ||
*/ | ||
@GetMapping("/list") | ||
@ApiOperation("根据分类id查询菜品") | ||
public R<List<DishVO>> list(Long categoryId) { | ||
Dish dish = new Dish(); | ||
dish.setCategoryId(categoryId); | ||
dish.setStatus(Dish.ON); | ||
|
||
List<DishVO> list = dishService.listWithFlavor(dish); | ||
|
||
return R.success(list); | ||
} | ||
|
||
} |
52 changes: 52 additions & 0 deletions
52
reggie_server/src/main/java/com/reggie/controller/user/SetmealController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.reggie.controller.user; | ||
|
||
import com.reggie.entity.Setmeal; | ||
import com.reggie.result.R; | ||
import com.reggie.service.SetmealService; | ||
import com.reggie.vo.DishItemVO; | ||
import io.swagger.annotations.Api; | ||
import io.swagger.annotations.ApiOperation; | ||
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 java.util.List; | ||
|
||
@RestController("userSetmealController") | ||
@RequestMapping("/user/setmeal") | ||
@Api(tags = "C端-套餐浏览接口") | ||
public class SetmealController { | ||
@Autowired | ||
private SetmealService setmealService; | ||
|
||
/** | ||
* 条件查询 | ||
* | ||
* @param categoryId | ||
* @return | ||
*/ | ||
@GetMapping("/list") | ||
@ApiOperation("根据分类id查询套餐") | ||
public R<List<Setmeal>> list(Long categoryId) { | ||
Setmeal setmeal = new Setmeal(); | ||
setmeal.setCategoryId(categoryId); | ||
setmeal.setStatus(Setmeal.ON); | ||
|
||
List<Setmeal> list = setmealService.list(setmeal); | ||
return R.success(list); | ||
} | ||
|
||
/** | ||
* 根据套餐id查询包含的菜品列表 | ||
* | ||
* @param id | ||
* @return | ||
*/ | ||
@GetMapping("/dish/{id}") | ||
@ApiOperation("根据套餐id查询包含的菜品列表") | ||
public R<List<DishItemVO>> dishList(@PathVariable("id") Long id) { | ||
List<DishItemVO> list = setmealService.getDishItemById(id); | ||
return R.success(list); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters