package io.renren.service.impl;


import io.renren.dao.SysEquipmentMapper;
import io.renren.entity.SysEquipment;
import io.renren.service.ISysEquipmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 设备信息Service业务层处理
 *
 * @author nichun
 * @date 2023-03-08
 */
@Service
public class SysEquipmentServiceImpl implements ISysEquipmentService
{
    @Autowired
    private SysEquipmentMapper sysEquipmentMapper;

    /**
     * 查询设备信息
     *
     * @param id 设备信息主键
     * @return 设备信息
     */
    @Override
    public SysEquipment selectSysEquipmentById(Long id)
    {
        return sysEquipmentMapper.selectSysEquipmentById(id);
    }

    /**
     * 查询设备信息列表
     *
     * @param sysEquipment 设备信息
     * @return 设备信息
     */
    @Override
    public List<SysEquipment> selectSysEquipmentList(SysEquipment sysEquipment)
    {
        return sysEquipmentMapper.selectSysEquipmentList(sysEquipment);
    }

    /**
     * 新增设备信息
     *
     * @param sysEquipment 设备信息
     * @return 结果
     */
    @Override
    public int insertSysEquipment(SysEquipment sysEquipment)
    {
        sysEquipment.setCreateTime(new Date());
        return sysEquipmentMapper.insertSysEquipment(sysEquipment);
    }

    /**
     * 修改设备信息
     *
     * @param sysEquipment 设备信息
     * @return 结果
     */
    @Override
    public int updateSysEquipment(SysEquipment sysEquipment)
    {
        sysEquipment.setUpdateTime(new Date());
        return sysEquipmentMapper.updateSysEquipment(sysEquipment);
    }

    /**
     * 批量删除设备信息
     *
     * @param ids 需要删除的设备信息主键
     * @return 结果
     */
    @Override
    public int deleteSysEquipmentByIds(Long[] ids)
    {
        return sysEquipmentMapper.deleteSysEquipmentByIds(ids);
    }

    /**
     * 删除设备信息信息
     *
     * @param id 设备信息主键
     * @return 结果
     */
    @Override
    public int deleteSysEquipmentById(Long id)
    {
        return sysEquipmentMapper.deleteSysEquipmentById(id);
    }

    @Override
    public SysEquipment selectEquipmentBySequence(String deviceNo) {
        return sysEquipmentMapper.selectEquipmentBySequence(deviceNo);
    }
}
