package com.sysu.admin.support.system.menu;

import com.xiesx.fastboot.core.jpa.JpaPlusRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface SMenuRepository extends JpaPlusRepository<SMenu, Long> {

    SMenu findByPermission(String permission);
    List<SMenu> findByParent(Long parent);

    @Query(value = "select * from sys_menu where is_enable = 0 order by sort asc,id asc", nativeQuery = true)
    List<SMenu> getMenuList();

    @Query(value = "select * from sys_menu where is_enable = 0 and is_menu = 0 order by sort asc,id asc", nativeQuery = true)
    List<SMenu> getNavigList();
}
