package com.diagbot.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.diagbot.entity.Menu;
import com.diagbot.entity.wrapper.MenuWrapper;
import com.diagbot.mapper.MenuMapper;
import com.diagbot.service.MenuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: MenuService实现类
 * @Author: ztg
 * @Date: 2018/9/13 16:56
 */
@Service
@Slf4j
public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements MenuService {

    @Autowired
    MenuMapper menuMapper;

    /**
     * 根据用户id获取菜单信息
     * @param userId 用户id
     * @return 菜单信息
     */
    @Override
    public List<MenuWrapper> getByRole(Long userId) {
        return menuMapper.getByRole(userId);
    }


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