package com.dgtly.system.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.dgtly.system.mapper.SysModelLayoutMapper;
import com.dgtly.system.domain.SysModelLayout;
import com.dgtly.system.service.ISysModelLayoutService;
import com.dgtly.common.core.text.Convert;

/**
 * 磁贴信息Service业务层处理
 * 
 * @author dgtly
 * @date 2019-10-30
 */
@Service
public class SysModelLayoutServiceImpl implements ISysModelLayoutService 
{
    @Autowired
    private SysModelLayoutMapper sysModelLayoutMapper;

    /**
     * 查询磁贴信息
     *
     * @return 磁贴信息
     */
    @Override
    public SysModelLayout selectSMLByUserIdMenuId(Long userId,Long menuId)
    {
        return sysModelLayoutMapper.selectSMLByUserIdMenuId(userId,menuId);
    }


    /**
     * 新增磁贴信息
     * 
     * @param sysModelLayout 磁贴信息
     * @return 结果
     */
    @Override
    public int insertSysModelLayout(SysModelLayout sysModelLayout)
    {
        return sysModelLayoutMapper.insertSysModelLayout(sysModelLayout);
    }

    /**
     * 修改磁贴信息
     * 
     * @param sysModelLayout 磁贴信息
     * @return 结果
     */
    @Override
    public int updateSysModelLayout(SysModelLayout sysModelLayout)
    {
        return sysModelLayoutMapper.updateSysModelLayout(sysModelLayout);
    }



    /**
     * 删除磁贴信息信息
     *
     * @return 结果
     */
    @Override
    public int deleteSysModelLayoutById(Long userId,Long menuId)
    {
        return sysModelLayoutMapper.deleteSMLByUserIdMenuId(userId,menuId);
    }

    /**
     * 根据用户id查询布局及菜单的相关信息
     * @param userId
     * @return
     */
    @Override
    public List<Map<String, Object>> selectModelMenu(Long userId) {
        return sysModelLayoutMapper.selectModelMenu(userId);
    }

    @Override
    public int deleteSMLs(String[] menuIds, Long userId) {
        return sysModelLayoutMapper.deleteSMLs(menuIds,userId);
    }

    @Override
    public int deleteSMLArray(List<String> menuIds, Long userId) {
        return sysModelLayoutMapper.deleteSMLs(menuIds.toArray(new String[menuIds.size()]),userId);
    }


}
