parent
1e919f41f2
commit
b2fb7eaec8
@ -0,0 +1,15 @@
|
||||
package com.school.lostfound.repository;
|
||||
|
||||
import com.school.lostfound.entity.Item;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import java.util.List;
|
||||
|
||||
public interface ItemRepository extends JpaRepository<Item, Long> {
|
||||
@Query("SELECT i FROM Item i WHERE i.type = ?1 " +
|
||||
"AND (i.name LIKE %?2% OR i.description LIKE %?2%) " +
|
||||
"AND i.location LIKE %?3% " +
|
||||
"AND i.status = 0")
|
||||
List<Item> matchItems(String type, String keyword, String location);
|
||||
List<Item> findByUserId(Long userId);
|
||||
}
|
||||
Loading…
Reference in new issue