package com.ruoyi.mingxue.service.impl;

import com.ruoyi.mingxue.domain.MxjbTagExt;
import com.ruoyi.mingxue.mapper.MxjbTagExtMapper;
import com.ruoyi.mingxue.service.IMxjbTagExtService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * mxjbTagExtService业务层处理
 * 
 * @author mingxue
 * @date 2022-09-14
 */
@Service
public class MxjbTagExtServiceImpl implements IMxjbTagExtService
{
    @Autowired
    private MxjbTagExtMapper mxjbTagExtMapper;

    /**
     * 查询mxjbTagExt
     * 
     * @param menuId mxjbTagExtID
     * @return mxjbTagExt
     */
    @Override
    public MxjbTagExt selectMxjbTagExtById(Long menuId)
    {
        return mxjbTagExtMapper.selectMxjbTagExtById(menuId);
    }

    /**
     * 查询mxjbTagExt列表
     * 
     * @param mxjbTagExt mxjbTagExt
     * @return mxjbTagExt
     */
    @Override
    public List<MxjbTagExt> selectMxjbTagExtList(MxjbTagExt mxjbTagExt)
    {
        return mxjbTagExtMapper.selectMxjbTagExtList(mxjbTagExt);
    }

    /**
     * 新增mxjbTagExt
     * 
     * @param mxjbTagExt mxjbTagExt
     * @return 结果
     */
    @Override
    public int insertMxjbTagExt(MxjbTagExt mxjbTagExt)
    {
        return mxjbTagExtMapper.insertMxjbTagExt(mxjbTagExt);
    }

    /**
     * 修改mxjbTagExt
     * 
     * @param mxjbTagExt mxjbTagExt
     * @return 结果
     */
    @Override
    public int updateMxjbTagExt(MxjbTagExt mxjbTagExt)
    {
        return mxjbTagExtMapper.updateMxjbTagExt(mxjbTagExt);
    }

    /**
     * 批量删除mxjbTagExt
     * 
     * @param menuIds 需要删除的mxjbTagExtID
     * @return 结果
     */
    @Override
    public int deleteMxjbTagExtByIds(Long[] menuIds)
    {
        return mxjbTagExtMapper.deleteMxjbTagExtByIds(menuIds);
    }

    /**
     * 删除mxjbTagExt信息
     * 
     * @param menuId mxjbTagExtID
     * @return 结果
     */
    @Override
    public int deleteMxjbTagExtById(Long menuId)
    {
        return mxjbTagExtMapper.deleteMxjbTagExtById(menuId);
    }

    @Override
    public Map<Long, Map<String, Object>> buildPcMenuExtMap() {
        Map<Long, Map<String, Object>> appMenuExtMap = this.selectMxjbTagExtList(new MxjbTagExt()).stream()
                .filter(t -> null != t.getInfo().getMeta())
                .collect(Collectors.toMap(MxjbTagExt::getMenuId, t -> t.getInfo().getMeta()));
        return appMenuExtMap;
    }
}
