package com.rf.psychological.menu.dao.repository;

import com.rf.psychological.base.repository.BaseRepository;
import com.rf.psychological.menu.dao.model.RoleMenuEntry;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import javax.transaction.Transactional;
import java.util.List;

public interface RoleMenuRepository extends BaseRepository<RoleMenuEntry,String> {

    List<RoleMenuEntry> findByRole(String role);

    List<RoleMenuEntry> findByMenuNo(String menuNo);

    @Transactional
//    @Modifying
//    @Query(value = "delete from t_role_menu where role = :roleNo",nativeQuery = true)
    void deleteByRole(@Param("roleNo") String roleNo);
}
