| | |
| | | @PostMapping(value = "/update") |
| | | public AjaxResult<String> update(@RequestBody TOrderMealDTO dto) { |
| | | // 删除所有菜品 |
| | | orderMealGoodsService.remove(Wrappers.lambdaQuery(TOrderMealGoods.class) |
| | | .eq(TOrderMealGoods::getOrderId, dto.getId())); |
| | | orderMealService.updateById(dto); |
| | | for (TOrderMealGoods mealOrderGood : dto.getMealOrderGoods()) { |
| | | // 设置商品类型和类型id |
| | | TGoodsType goodsType = goodsTypeService.getById(mealOrderGood.getTypeId()); |
| | | mealOrderGood.setId(null); |
| | | mealOrderGood.setOrderId(dto.getId()); |
| | | mealOrderGood.setTypeId(goodsType.getId()); |
| | | mealOrderGood.setTypeName(goodsType.getTypeName()); |
| | | if(!CollectionUtils.isEmpty(dto.getMealOrderGoods())){ |
| | | orderMealGoodsService.remove(Wrappers.lambdaQuery(TOrderMealGoods.class) |
| | | .eq(TOrderMealGoods::getOrderId, dto.getId())); |
| | | for (TOrderMealGoods mealOrderGood : dto.getMealOrderGoods()) { |
| | | // 设置商品类型和类型id |
| | | TGoodsType goodsType = goodsTypeService.getById(mealOrderGood.getTypeId()); |
| | | mealOrderGood.setId(null); |
| | | mealOrderGood.setOrderId(dto.getId()); |
| | | mealOrderGood.setTypeId(goodsType.getId()); |
| | | mealOrderGood.setTypeName(goodsType.getTypeName()); |
| | | } |
| | | orderMealGoodsService.saveBatch(dto.getMealOrderGoods()); |
| | | } |
| | | orderMealGoodsService.saveBatch(dto.getMealOrderGoods()); |
| | | return AjaxResult.success(); |
| | | } |
| | | @ApiOperation( value = "列表详情结账") |
| | | @PostMapping(value = "/detailUpdate") |
| | | public AjaxResult<String> detailUpdate(@RequestBody TOrderMealDTO dto) { |
| | | // 删除所有菜品 |
| | | orderMealGoodsService.remove(Wrappers.lambdaQuery(TOrderMealGoods.class) |
| | | .eq(TOrderMealGoods::getOrderId, dto.getId())); |
| | | orderMealService.updateById(dto); |
| | | // 查询餐桌 |
| | | List<TOrderMealGoods> mealOrderGoods = dto.getMealOrderGoods(); |
| | | if (!CollectionUtils.isEmpty(mealOrderGoods)) { |
| | | // 删除所有菜品 |
| | | orderMealGoodsService.remove(Wrappers.lambdaQuery(TOrderMealGoods.class) |
| | | .eq(TOrderMealGoods::getOrderId, dto.getId())); |
| | | for (TOrderMealGoods mealOrderGood : mealOrderGoods) { |
| | | // 设置商品类型和类型id |
| | | mealOrderGood.setId(null); |