package com.storlead.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.storlead.system.pojo.entity.MenuEntity;
import com.storlead.system.mapper.MenuMapper;
import com.storlead.system.service.IMenuService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MenuServiceImpl extends ServiceImpl<MenuMapper, MenuEntity> implements IMenuService {

    @Override
    public List<MenuEntity> queryByUsername(String userName) {
        return this.baseMapper.queryByUsername(userName);
    }

    @Override
    public MenuEntity getRootLastNodeInfo(Long pid, Long appId) {
        return this.baseMapper.selectRootLastNodeInfo(pid, appId);
    }

    @Override
    public List<MenuEntity> getUserMenuList(Long userId,Long appId,List<Integer> modeTypes,List<Integer> menuTypes) {
        return this.baseMapper.selectUserMenuList(userId, appId, modeTypes ,menuTypes);
    }

    @Override
    public List<MenuEntity> getUserMenuList(Long userId,List<Integer> modeTypes,List<Integer> menuTypes) {
        return this.getUserMenuList(userId,null, modeTypes ,menuTypes);
    }

    @Override
    public Integer checkUserMenuAccess(Long userId) {
        return this.baseMapper.selectUserMenuCount(userId);
    }


    @Override
    public List<MenuEntity> getAllMenuCreateTree() {
        return this.baseMapper.selectMenuCreateTree();
    }

}
