package com.diagbot.service.impl;

import com.diagbot.dto.SysUserPermissionDTO;
import com.diagbot.entity.SysMenu;
import com.diagbot.entity.wrapper.SysMenuWrapper;
import com.diagbot.mapper.SysMenuMapper;
import com.diagbot.service.SysMenuService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;

/**
 * <p>
 * 系统菜单 服务实现类
 * </p>
 *
 * @author gaodm
 * @time: 2024-04-12
 */
@Service
public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements SysMenuService {

    /**
     * 根据用户id获取菜单信息
     *
     * @param userId 用户id
     * @return 菜单信息
     */
    @Override
    public List<SysMenuWrapper> getByRole(Long userId, Set<String> roleSet) {
        return baseMapper.getByRole(userId,roleSet);
    }


    /**
     * 获取下级菜单
     *
     * @param id 菜单id
     * @return 子菜单信息
     */
    @Override
    public List<SysMenuWrapper> getSubMenuById(Long id) {
        return baseMapper.getSubMenuById(id);
    }

    @Override
    public List<SysUserPermissionDTO> getByRolePermission(Long userId,Set<String> roleSet){
        return baseMapper.getByRolePermission(userId,roleSet);
    }
}
