package com.xkrs.dao;

import com.xkrs.model.entity.RelRoleAuthorityEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * @author XinYi Song
 */
public interface RelRoleAuthorityDao extends JpaRepository<RelRoleAuthorityEntity,Long> {

    /**
     * 根据userId查询出权限的id
     * @param userId
     * @return
     */
    @Query(value = "select authority_id from rel_role_authority where user_id = ?",nativeQuery = true)
    List<Integer> selectAuthorityByUserId(@Param("userId") Integer userId);
}
