根据分类id查询菜品
This commit is contained in:
parent
3eb910ad07
commit
de3cbdf97e
|
@ -2,6 +2,7 @@ package com.sky.controller.admin;
|
|||
|
||||
import com.sky.dto.DishDTO;
|
||||
import com.sky.dto.DishPageQueryDTO;
|
||||
import com.sky.entity.Dish;
|
||||
import com.sky.result.PageResult;
|
||||
import com.sky.result.Result;
|
||||
import com.sky.service.DishService;
|
||||
|
@ -105,4 +106,17 @@ public class DishController {
|
|||
dishService.startOrStop(status, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分类id查询菜品
|
||||
*
|
||||
* @param categoryId Long
|
||||
* @return Result<List < Dish>>
|
||||
*/
|
||||
@ApiOperation("根据分类id查询菜品")
|
||||
@GetMapping("list")
|
||||
public Result<List<Dish>> list(Long categoryId) {
|
||||
List<Dish> list = dishService.list(categoryId);
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package com.sky.controller.admin;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@Slf4j
|
||||
public class SetmealController {
|
||||
}
|
|
@ -61,4 +61,12 @@ public interface DishService {
|
|||
* @param id 菜品id
|
||||
*/
|
||||
void startOrStop(Integer status, Long id);
|
||||
|
||||
/**
|
||||
* 根据分类id查询菜品
|
||||
*
|
||||
* @param categoryId Long
|
||||
* @return List<Dish>
|
||||
*/
|
||||
List<Dish> list(Long categoryId);
|
||||
}
|
||||
|
|
|
@ -196,4 +196,16 @@ public class DishServiceImpl implements DishService {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据分类id查询菜品
|
||||
*
|
||||
* @param categoryId Long
|
||||
* @return List<Dish>
|
||||
*/
|
||||
@Override
|
||||
public List<Dish> list(Long categoryId) {
|
||||
Dish dish = Dish.builder().categoryId(categoryId).status(StatusConstant.ENABLE).build();
|
||||
return dishMapper.list(dish);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue