package com.ruoyi.system.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TbSchoolFacilitiesContrastIconMapper;
import com.ruoyi.system.domain.TbSchoolFacilitiesContrastIcon;
import com.ruoyi.system.service.ITbSchoolFacilitiesContrastIconService;
import com.ruoyi.common.core.text.Convert;

/**
 * 院校设施名称和图片对照Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-10-12
 */
@Service
public class TbSchoolFacilitiesContrastIconServiceImpl implements ITbSchoolFacilitiesContrastIconService 
{
    @Autowired
    private TbSchoolFacilitiesContrastIconMapper tbSchoolFacilitiesContrastIconMapper;

    /**
     * 查询院校设施名称和图片对照
     * 
     * @param id 院校设施名称和图片对照主键
     * @return 院校设施名称和图片对照
     */
    @Override
    public TbSchoolFacilitiesContrastIcon selectTbSchoolFacilitiesContrastIconById(Long id)
    {
        return tbSchoolFacilitiesContrastIconMapper.selectTbSchoolFacilitiesContrastIconById(id);
    }

    /**
     * 查询院校设施名称和图片对照列表
     * 
     * @param tbSchoolFacilitiesContrastIcon 院校设施名称和图片对照
     * @return 院校设施名称和图片对照
     */
    @Override
    public List<TbSchoolFacilitiesContrastIcon> selectTbSchoolFacilitiesContrastIconList(TbSchoolFacilitiesContrastIcon tbSchoolFacilitiesContrastIcon)
    {
        return tbSchoolFacilitiesContrastIconMapper.selectTbSchoolFacilitiesContrastIconList(tbSchoolFacilitiesContrastIcon);
    }

    /**
     * 新增院校设施名称和图片对照
     * 
     * @param tbSchoolFacilitiesContrastIcon 院校设施名称和图片对照
     * @return 结果
     */
    @Override
    public String insertTbSchoolFacilitiesContrastIcon(TbSchoolFacilitiesContrastIcon tbSchoolFacilitiesContrastIcon)
    {
        int i=tbSchoolFacilitiesContrastIconMapper.queryByFacilitiesTypeAndName(tbSchoolFacilitiesContrastIcon);
        if(i>0){
            return "该设施已经添加过了";
        }
        tbSchoolFacilitiesContrastIconMapper.insertTbSchoolFacilitiesContrastIcon(tbSchoolFacilitiesContrastIcon);
        return "添加成功";
    }

    /**
     * 修改院校设施名称和图片对照
     * 
     * @param tbSchoolFacilitiesContrastIcon 院校设施名称和图片对照
     * @return 结果
     */
    @Override
    public int updateTbSchoolFacilitiesContrastIcon(TbSchoolFacilitiesContrastIcon tbSchoolFacilitiesContrastIcon)
    {
        return tbSchoolFacilitiesContrastIconMapper.updateTbSchoolFacilitiesContrastIcon(tbSchoolFacilitiesContrastIcon);
    }

    /**
     * 批量删除院校设施名称和图片对照
     * 
     * @param ids 需要删除的院校设施名称和图片对照主键
     * @return 结果
     */
    @Override
    public int deleteTbSchoolFacilitiesContrastIconByIds(String ids)
    {
        return tbSchoolFacilitiesContrastIconMapper.deleteTbSchoolFacilitiesContrastIconByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除院校设施名称和图片对照信息
     * 
     * @param id 院校设施名称和图片对照主键
     * @return 结果
     */
    @Override
    public int deleteTbSchoolFacilitiesContrastIconById(Long id)
    {
        return tbSchoolFacilitiesContrastIconMapper.deleteTbSchoolFacilitiesContrastIconById(id);
    }

    /**
     * @Author : fanxiaolong
     * @Description :  查询设施类型
     * @DateTime : 2022/10/12 14:49
     * @param :
     * @return : java.util.List<java.lang.String>
     */
    @Override
    public List<String> getFacilitiesTypeList(){
        return tbSchoolFacilitiesContrastIconMapper.getFacilitiesTypeList();
    }

    /**
     * @Author : fanxiaolong
     * @Description : 根据设施类型查询设施
     * @DateTime : 2022/10/12 14:55
     * @param : type
     * @return : java.util.List<com.ruoyi.system.domain.TbSchoolFacilitiesContrastIcon>
     */
    @Override
    public List<TbSchoolFacilitiesContrastIcon> queryFacilitiesByType(String type){

        return tbSchoolFacilitiesContrastIconMapper.queryFacilitiesByType(type);
    }
}
