| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.domain. TBoard; |
| | | import com.ruoyi.system.domain.TOrderMeal; |
| | |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | List<Long> ids = list.stream().filter(e -> !e.getStatus().equals(1)).map(TBoard::getId).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(ids)){ |
| | | List<TOrderMeal> orderMeals = orderMealService.list(Wrappers.lambdaQuery(TOrderMeal.class) |
| | | .in(TOrderMeal::getBoardId, ids)); |
| | | .in(TOrderMeal::getBoardId, ids) |
| | | .isNotNull(TOrderMeal::getMealTime) |
| | | .orderByDesc(TOrderMeal::getCreateTime)); |
| | | for (TBoard board : list) { |
| | | List<TOrderMeal> collect = orderMeals.stream().filter(e -> board.getId().equals(e.getBoardId())).collect(Collectors.toList()); |
| | | List<TOrderMeal> collect = orderMeals.stream().filter(e -> board.getId().equals(e.getBoardId())).sorted(Comparator.comparing(TOrderMeal::getCreateTime).reversed()).collect(Collectors.toList()); |
| | | if(!CollectionUtils.isEmpty(collect)){ |
| | | board.setMealType(collect.get(0).getMealType()); |
| | | board.setMealPerson(collect.get(0).getMealPerson()); |
| | | board.setOrderMoney(collect.get(0).getOrderMoney()); |
| | | board.setOrderMealId(collect.get(0).getId()); |
| | | } |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 添加 餐桌管理 |
| | | */ |
| | | @Log(title = "餐桌-添加餐桌", businessType = BusinessType.INSERT) |
| | | @ApiOperation( value = "添加餐桌") |
| | | @PostMapping(value = "/add") |
| | | public AjaxResult<Boolean> add(@RequestBody TBoard dto) { |
| | |
| | | /** |
| | | * 删除 餐桌 |
| | | */ |
| | | @Log(title = "餐桌-删除餐桌", businessType = BusinessType.DELETE) |
| | | @ApiOperation( value = "删除餐桌") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public AjaxResult<Boolean> deleteById(@RequestParam("id") Long id) { |