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.
42 lines
1.3 KiB
42 lines
1.3 KiB
package com.gym.repository;
|
|
|
|
import com.gym.model.Equipment;
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Pageable;
|
|
import org.springframework.data.jpa.repository.JpaRepository;
|
|
import org.springframework.stereotype.Repository;
|
|
import java.util.List;
|
|
|
|
@Repository
|
|
public interface EquipmentRepository extends JpaRepository<Equipment, Long> {
|
|
|
|
// 根据是否可用查询
|
|
List<Equipment> findByIsAvailableTrue();
|
|
|
|
// 根据名称模糊查询(带分页)
|
|
Page<Equipment> findByNameContaining(String name, Pageable pageable);
|
|
|
|
// 根据状态查询(带分页)
|
|
Page<Equipment> findByStatus(String status, Pageable pageable);
|
|
|
|
// 根据品牌查询(带分页)
|
|
Page<Equipment> findByBrand(String brand, Pageable pageable);
|
|
|
|
// 根据状态和品牌查询(带分页)
|
|
Page<Equipment> findByStatusAndBrand(String status, String brand, Pageable pageable);
|
|
|
|
// 根据名称模糊查询
|
|
List<Equipment> findByNameContaining(String name);
|
|
|
|
// 根据状态查询
|
|
List<Equipment> findByStatus(String status);
|
|
|
|
// 根据品牌查询
|
|
List<Equipment> findByBrand(String brand);
|
|
|
|
// 根据位置查询
|
|
List<Equipment> findByLocation(String location);
|
|
|
|
// 统计不同状态的数量
|
|
Long countByStatus(String status);
|
|
} |