6/20 完善了菜品删除时对套餐的处理
This commit is contained in:
parent
88c5118927
commit
5ce6e3ccc7
@ -1,5 +1,6 @@
|
|||||||
package io.renren.modules.takeout.controller;
|
package io.renren.modules.takeout.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import io.renren.common.annotation.LogOperation;
|
import io.renren.common.annotation.LogOperation;
|
||||||
import io.renren.common.constant.Constant;
|
import io.renren.common.constant.Constant;
|
||||||
@ -13,7 +14,11 @@ import io.renren.common.validator.group.DefaultGroup;
|
|||||||
import io.renren.common.validator.group.UpdateGroup;
|
import io.renren.common.validator.group.UpdateGroup;
|
||||||
import io.renren.modules.front.bean.Category;
|
import io.renren.modules.front.bean.Category;
|
||||||
import io.renren.modules.front.bean.DishFlavor;
|
import io.renren.modules.front.bean.DishFlavor;
|
||||||
|
import io.renren.modules.front.bean.Setmeal;
|
||||||
|
import io.renren.modules.front.bean.SetmealDish;
|
||||||
import io.renren.modules.front.service.CategoryService;
|
import io.renren.modules.front.service.CategoryService;
|
||||||
|
import io.renren.modules.front.service.SetmealDishService;
|
||||||
|
import io.renren.modules.front.service.SetmealService;
|
||||||
import io.renren.modules.takeout.dto.DishDTO;
|
import io.renren.modules.takeout.dto.DishDTO;
|
||||||
import io.renren.modules.takeout.dto.DishFlavorDTO;
|
import io.renren.modules.takeout.dto.DishFlavorDTO;
|
||||||
import io.renren.modules.takeout.entity.DishEntity;
|
import io.renren.modules.takeout.entity.DishEntity;
|
||||||
@ -52,6 +57,8 @@ public class DishController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private io.renren.modules.front.service.DishFlavorService dishFlavorServiceFront;
|
private io.renren.modules.front.service.DishFlavorService dishFlavorServiceFront;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SetmealDishService setmealDishService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private CategoryService categoryService;
|
private CategoryService categoryService;
|
||||||
|
|
||||||
@ -188,6 +195,14 @@ public class DishController {
|
|||||||
public Result delete(@RequestBody Long[] ids){
|
public Result delete(@RequestBody Long[] ids){
|
||||||
//效验数据
|
//效验数据
|
||||||
AssertUtils.isArrayEmpty(ids, "id");
|
AssertUtils.isArrayEmpty(ids, "id");
|
||||||
|
for(Long id:ids){
|
||||||
|
LambdaQueryWrapper<SetmealDish> wrapper=new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(SetmealDish::getDishId,id);
|
||||||
|
if(setmealDishService.list(wrapper)!=null) {
|
||||||
|
return new Result().error("存在套餐内含有该菜品");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
dishService.delete(ids);
|
dishService.delete(ids);
|
||||||
//清除每个菜品的所有口味信息
|
//清除每个菜品的所有口味信息
|
||||||
|
@ -104,6 +104,7 @@ public class SetmealController {
|
|||||||
//效验数据
|
//效验数据
|
||||||
AssertUtils.isArrayEmpty(ids, "id");
|
AssertUtils.isArrayEmpty(ids, "id");
|
||||||
|
|
||||||
|
|
||||||
setmealService.delete(ids);
|
setmealService.delete(ids);
|
||||||
|
|
||||||
return new Result();
|
return new Result();
|
||||||
@ -120,9 +121,9 @@ public class SetmealController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("updateStatus")
|
@PutMapping("updateStatus")
|
||||||
@ApiOperation("更新套餐状态")
|
// @ApiOperation("更新套餐状态")
|
||||||
@LogOperation("更新套餐状态")
|
// @LogOperation("更新套餐状态")
|
||||||
@RequiresPermissions("takeout:setmeal:updateStatus")
|
// @RequiresPermissions("takeout:setmeal:updateStatus")
|
||||||
@CacheEvict(value = "setmealCache", allEntries = true)
|
@CacheEvict(value = "setmealCache", allEntries = true)
|
||||||
public Result updateStatus(@RequestParam Map<String, String> params) {
|
public Result updateStatus(@RequestParam Map<String, String> params) {
|
||||||
List<String> ids=new ArrayList<>();
|
List<String> ids=new ArrayList<>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user