com.sippnex.fileblade.repositories.FilebladeItemRepository Maven / Gradle / Ivy
package com.sippnex.fileblade.repositories;
import com.sippnex.fileblade.entities.FilebladeItem;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import java.util.List;
import java.util.Optional;
public interface FilebladeItemRepository extends CrudRepository {
T findByName(String name);
@Query("SELECT i FROM FilebladeItem i WHERE parentDirectory IS NULL")
List findRootItems();
@Query("SELECT i FROM FilebladeItem i WHERE parentDirectory IS NULL AND LOWER(i.name) = LOWER(:name)")
Optional findRootItemByName(@Param("name") String name);
}