package com.mosquito.project.permission;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

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

/**
 * 权限Repository
 */
@Repository
public interface PermissionRepository extends JpaRepository<SysPermission, Long> {

    /**
     * 根据权限代码查询
     */
    Optional<SysPermission> findByPermissionCode(String permissionCode);

    /**
     * 根据模块代码查询
     */
    List<SysPermission> findByModuleCode(String moduleCode);

    /**
     * 检查权限代码是否存在
     */
    boolean existsByPermissionCode(String permissionCode);
}
