package com.ffii.fhsmsc.modules.User_group.repository;

import com.ffii.core.support.AbstractRepository;
import com.ffii.fhsmsc.modules.User_group.enity.authority;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface authorityReponsitory extends AbstractRepository<authority, Long> {
    
    @Query("SELECT a FROM authority a WHERE a.authority = :authority")
    Optional<authority> findByAuthority(@Param("authority") String authority);

    @Query("SELECT a FROM authority a WHERE a.name = :name")
    Optional<authority> findByName(@Param("name") String name);

    @Query("SELECT a FROM authority a ORDER BY a.id")
    List<authority> findAllOrderedById();
} 