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
20 lines
795 B
package org.ros.chatto.repository;
|
|
|
|
import java.util.List;
|
|
|
|
import org.ros.chatto.model.UserRole;
|
|
import org.springframework.data.jpa.repository.JpaRepository;
|
|
import org.springframework.data.jpa.repository.Query;
|
|
import org.springframework.stereotype.Repository;
|
|
|
|
@Repository
|
|
public interface UserRoleRepository extends JpaRepository<UserRole, Long> {
|
|
@Query("select ur from UserRole ur join fetch ur.user join fetch ur.role where ur.user.userID = ?1")
|
|
public List<UserRole> findByUser(int userID);
|
|
|
|
@Query("select ur from UserRole ur join fetch ur.user join fetch ur.role where ur.user.userName = ?1")
|
|
public List<UserRole> findByUser(String username);
|
|
|
|
@Query("select ur.user.userName from UserRole ur join ur.role where ur.role.roleID = 2")
|
|
public List<String> getAllRegularUser();
|
|
}
|