package com.ywt.mg.domain.mealEntities;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @author Walker
 * Created on 2019/3/6
 */
public interface OrderDishRepository extends JpaRepository<OrderDish, Integer> {
    // 获取 order_dish by orderId, 包括 deleted = 1 的历史菜品，通常用于获取订单菜品列表历史信息
    @Query(value = "select * from order_dish where order_id = ? ;", nativeQuery = true)
    List<OrderDish> getAllByOrderId(int orderId);

    @Query(value = "select * from order_dish;", nativeQuery = true)
    List<OrderDish> getAllOrderDishes();
}
