package com.example.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.example.domain.Shoes;

//靴データ取得用
//statusによって出し分け
public interface ShoesRepository extends JpaRepository<Shoes, Integer>{
	@Query(value = "SELECT * FROM shoes WHERE product_status = ?1 ORDER BY id DESC", nativeQuery = true)
	public List <Shoes> findAllByStatus(Integer status);
<<<<<<< HEAD
	
	//商品名あいまい検索
	@Query(value = "SELECT * FROM shoes WHERE name LIKE %:keyword% ORDER BY id DESC", nativeQuery = true)
	public List <Shoes> findAllForSearch(@Param("keyword") String keyword);
	
	//サイズ検索
	@Query(value = "SELECT * FROM shoes WHERE size =?1 ORDER BY id DESC", nativeQuery = true)
	public List <Shoes> findAllBySize(Integer size);
}
=======

//管理画面で使用
	@Query(value = "SELECT * FROM shoes WHERE name = ?1 && size = ?2", nativeQuery = true)
	public Shoes findOneAddStock(String name, Integer size);

}
>>>>>>> 6c5981d65b423f7ba8b4f9fef90d0047960002bb
