Skip to content

Commit

Permalink
BUG修改
Browse files Browse the repository at this point in the history
  • Loading branch information
Q-1515 committed Jul 22, 2022
1 parent aa1647b commit 8924727
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ public R<String> delete(@RequestParam List<Long> ids) {
* @return DishVO 菜品的参数
*/
@GetMapping("/{id}")
@ApiOperation("根据id查询菜品")
@ApiOperation("根据id查询菜品和关联的口味")
public R<DishVO> select(@PathVariable Long id) {
log.info("根据id查询菜品:{}", id);
log.info("根据id查询菜品和关联的口味:{}", id);
DishVO dishVO = dishService.getByIdWithFlavor(id);
return R.success(dishVO);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ public R<String> update(@RequestBody SetmealDTO setmealDTO) {
* @return success
*/
@PostMapping("/status/{status}")
@ApiOperation("修改套餐")
public R<String> startOrStop(@PathVariable Integer status, Long id) {
log.info("修改套餐:{}", status);
setmealService.startOrStop(status,id);
setmealService.startOrStop(status, id);
return R.success("状态修改成功");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void delete(List<Long> ids) {
ids.forEach(dishId -> {
Dish dish = dishMapper.selectById(dishId);
// 起售的菜品不能删除
if (StatusConstant.DISABLE == dish.getStatus()) {
if (StatusConstant.ENABLE == dish.getStatus()) {
throw new DeletionNotAllowedException(MessageConstant.DISH_ON_SALE);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public void update(SetmealDTO setmealDTO) {
*/
public void startOrStop(Integer status, Long id) {
//起售套餐时,判断套餐内是否有停售菜品,有停售菜品提示"套餐内包含未启售菜品,无法启售"
if (StatusConstant.DISABLE == status) {
if (StatusConstant.ENABLE == status) {
//根据套餐id查询菜品
List<Dish> dishList = dishMapper.getBySetmealId(id);
if (dishList != null && dishList.size() > 0) {
Expand Down
2 changes: 1 addition & 1 deletion reggie_server/src/main/resources/mapper/DishMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
select dish.*
from dish
left join setmeal_dish sd on dish.id = sd.dish_id
where sd.id = #{setmealId}
where sd.setmeal_id = #{setmealId}
</select>

</mapper>
6 changes: 3 additions & 3 deletions reggie_server/src/main/resources/mapper/SetmealDishMapper.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
<!--套餐id删除套餐菜品关系表中的数据-->
<delete id="deleteBySetmealId">
delete from setmeal_dish
where dish_id in
<foreach collection="ids" item="dish_id" separator="," open="(" close=")">
#{dish_id}
where setmeal_id in
<foreach collection="ids" item="setmeal_id" separator="," open="(" close=")">
#{setmeal_id}
</foreach>
</delete>

Expand Down

0 comments on commit 8924727

Please sign in to comment.