package com.ga.common.menu; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; /** * 메뉴/권한 DB 매퍼 (MyBatis). SQL은 동명 XML 매퍼에 정의된다. * selectUserPermissions는 (menuId, permCode) 행들을 돌려주며, 서비스가 메뉴별로 묶는다. */ @Mapper public interface MenuMapper { /** 전체 활성 메뉴 (정렬됨) */ List selectAllActive(); /** 사용자가 접근 가능한 메뉴 목록 */ List selectAccessibleMenusByUserId(@Param("userId") Long userId); /** 사용자별 (menuId → permCodes) 매핑 */ List> selectUserPermissions(@Param("userId") Long userId); /** 단일 (menuCode, permCode) 권한 보유 여부 */ int hasPermission(@Param("userId") Long userId, @Param("menuCode") String menuCode, @Param("permCode") String permCode); MenuVO selectById(@Param("menuId") Long menuId); MenuVO selectByCode(@Param("menuCode") String menuCode); int insert(MenuVO vo); int update(MenuVO vo); int deleteById(@Param("menuId") Long menuId); int countChildren(@Param("menuId") Long menuId); }