Created
April 27, 2017 12:50
-
-
Save edermfl/ba5cff9e0d6a2c98dbe5986c5917a3cd to your computer and use it in GitHub Desktop.
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
public interface TimeRepository extends JpaRepository<Time, Long> { | |
@Query(value = "SELECT t.* FROM time t " | |
+ "cross JOIN boleiro_time bt, boleiro b " | |
+ "WHERE t.id = bt.id_time " | |
+ "AND bt.id_boleiro = b.id " | |
+ "AND b.id_usuario = ?1 " | |
+ "AND (t.id_gerente = ?1 " | |
+ " OR bt.id_boleiro IN (SELECT b2.id FROM boleiro b2 WHERE b2.id_usuario= ?1)" | |
+ ")", nativeQuery = true) | |
List<Time> findByIdUsuario(Long pIdUsuario); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment