敏捷工具
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.

44 lines
1.5 KiB

2 years ago
  1. package com.whn.hellospring.repository;
  2. import com.whn.hellospring.model.OilDO;
  3. import org.springframework.data.domain.Page;
  4. import org.springframework.data.domain.Pageable;
  5. import org.springframework.data.domain.Sort;
  6. import org.springframework.data.jpa.domain.Specification;
  7. import org.springframework.data.jpa.repository.JpaRepository;
  8. import org.springframework.data.jpa.repository.Query;
  9. import org.springframework.stereotype.Repository;
  10. import java.util.List;
  11. @Repository
  12. public interface OilRepository extends JpaRepository<OilDO,Long> {
  13. /**
  14. * 分页查询所有
  15. *
  16. * @param spec
  17. * @param pageable
  18. * @return
  19. */
  20. Page<OilDO> findAll(Specification spec, Pageable pageable);
  21. @Query(value = "select * from t_oil where customer_id = ?1 ORDER BY time Desc ",nativeQuery = true)
  22. List<OilDO> finAllSortByTime(Long customer_id);
  23. @Query(value = "select sum(num) from t_oil where status=1 && customer_id = ?1",nativeQuery = true)
  24. double countNum(Long customer_id);
  25. @Query(value = "select sum(interval_mileage) from t_oil where status=1 && customer_id = ?1",nativeQuery = true)
  26. double countIntervalMileage(Long customer_id);
  27. @Query(value = "select interval_oil_wear from t_oil where status=1 && customer_id=?1 ORDER BY time ASC",nativeQuery = true)
  28. List<Double> findWearList(Long customer_id);
  29. @Query(value = "select fuel_one_day from t_oil where status=1 && customer_id=?1 ORDER BY time ASC",nativeQuery = true)
  30. List<Double> findFuelOneDay(Long customer_id);
  31. }