A self hosted chat application with end-to-end encrypted messaging.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
795 B

5 years ago
5 years ago
5 years ago
  1. package org.ros.chatto.repository;
  2. import java.util.List;
  3. import org.ros.chatto.model.UserRole;
  4. import org.springframework.data.jpa.repository.JpaRepository;
  5. import org.springframework.data.jpa.repository.Query;
  6. import org.springframework.stereotype.Repository;
  7. @Repository
  8. public interface UserRoleRepository extends JpaRepository<UserRole, Long> {
  9. @Query("select ur from UserRole ur join fetch ur.user join fetch ur.role where ur.user.userID = ?1")
  10. public List<UserRole> findByUser(int userID);
  11. @Query("select ur from UserRole ur join fetch ur.user join fetch ur.role where ur.user.userName = ?1")
  12. public List<UserRole> findByUser(String username);
  13. @Query("select ur.user.userName from UserRole ur join ur.role where ur.role.roleID = 2")
  14. public List<String> getAllRegularUser();
  15. }