敏捷工具
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.2 KiB

2 years ago
  1. package com.whn.hellospring.repository;
  2. import com.whn.hellospring.model.CoffeeOrderDO;
  3. import org.apache.ibatis.annotations.Delete;
  4. import org.springframework.data.jpa.repository.JpaRepository;
  5. import org.springframework.data.jpa.repository.Modifying;
  6. import org.springframework.data.jpa.repository.Query;
  7. import org.springframework.transaction.annotation.Transactional;
  8. import javax.xml.ws.soap.MTOM;
  9. import java.util.List;
  10. /**
  11. * 订单数据操作
  12. */
  13. public interface CoffeeOrderRepository extends JpaRepository<CoffeeOrderDO, Long> {
  14. // //根据咖啡名,获取订单
  15. // List<CoffeeOrderDO> findByItems_Name(String name);
  16. //根据订单id获取订单
  17. @Query(value = "select * from T_ORDER where id=?1",nativeQuery = true)
  18. CoffeeOrderDO queryOrderWithId(Long id);
  19. //根据订单id删除订单
  20. @Transactional //事务
  21. @Modifying //更新
  22. @Query(value = "DELETE from T_ORDER where id=?1",nativeQuery = true)
  23. int deleteOrderWithId(Long id);
  24. //根据客户,获取订单
  25. @Query(value = "select * from t_order where customer_id = ?1", nativeQuery = true)
  26. List<CoffeeOrderDO> queryOrderListWithCustomerId(String customerId);
  27. }