-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
06caeb1
commit 6e14d7f
Showing
2 changed files
with
16 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
src/main/java/com/julianocanuto/controleestoque/repositorios/IngredienteRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
package com.julianocanuto.controleestoque.repositorios; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import com.julianocanuto.controleestoque.entidades.Ingrediente; | ||
import com.julianocanuto.controleestoque.repositorios.projections.IngredienteNomeQuantidadeProjection; | ||
|
||
@Repository | ||
public interface IngredienteRepository extends JpaRepository<Ingrediente, Long>{ | ||
|
||
@Query(nativeQuery = true, | ||
value = "SELECT TB_INGREDIENTE.nome, TB_ESTOQUE.quantidade " | ||
+ "FROM TB_INGREDIENTE " | ||
+ "INNER JOIN TB_ESTOQUE ON TB_INGREDIENTE.estoque_id = TB_ESTOQUE.id") | ||
List<IngredienteNomeQuantidadeProjection> getNomeQuantidadeIngredientes(); | ||
} |
7 changes: 7 additions & 0 deletions
7
...ocanuto/controleestoque/repositorios/projections/IngredienteNomeQuantidadeProjection.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.julianocanuto.controleestoque.repositorios.projections; | ||
|
||
public interface IngredienteNomeQuantidadeProjection { | ||
|
||
String getNome(); | ||
Integer getQuantidade(); | ||
} |