package com.fs.watch.service.impl;

import com.fs.common.utils.DateUtils;
import com.fs.watch.domain.DeviceMaterialsType;
import com.fs.watch.mapper.DeviceMaterialsTypeMapper;
import com.fs.watch.service.DeviceMaterialsTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 设备物料种类Service业务层处理
 *
 * @author fs
 * @date 2024-08-27
 */
@Service
public class DeviceMaterialsTypeServiceImpl implements DeviceMaterialsTypeService
{
    @Autowired
    private DeviceMaterialsTypeMapper deviceMaterialsTypeMapper;

    /**
     * 查询设备物料种类
     *
     * @param id 设备物料种类主键
     * @return 设备物料种类
     */
    @Override
    public DeviceMaterialsType selectDeviceMaterialsTypeById(Long id)
    {
        return deviceMaterialsTypeMapper.selectDeviceMaterialsTypeById(id);
    }

    /**
     * 查询设备物料种类列表
     *
     * @param deviceMaterialsType 设备物料种类
     * @return 设备物料种类
     */
    @Override
    public List<DeviceMaterialsType> selectDeviceMaterialsTypeList(DeviceMaterialsType deviceMaterialsType)
    {
        return deviceMaterialsTypeMapper.selectDeviceMaterialsTypeList(deviceMaterialsType);
    }

    /**
     * 新增设备物料种类
     *
     * @param deviceMaterialsType 设备物料种类
     * @return 结果
     */
    @Override
    public int insertDeviceMaterialsType(DeviceMaterialsType deviceMaterialsType)
    {
        deviceMaterialsType.setCreateTime(DateUtils.getNowDate());
        return deviceMaterialsTypeMapper.insertDeviceMaterialsType(deviceMaterialsType);
    }

    /**
     * 修改设备物料种类
     *
     * @param deviceMaterialsType 设备物料种类
     * @return 结果
     */
    @Override
    public int updateDeviceMaterialsType(DeviceMaterialsType deviceMaterialsType)
    {
        deviceMaterialsType.setUpdateTime(DateUtils.getNowDate());
        return deviceMaterialsTypeMapper.updateDeviceMaterialsType(deviceMaterialsType);
    }

    /**
     * 批量删除设备物料种类
     *
     * @param ids 需要删除的设备物料种类主键
     * @return 结果
     */
    @Override
    public int deleteDeviceMaterialsTypeByIds(Long[] ids)
    {
        return deviceMaterialsTypeMapper.deleteDeviceMaterialsTypeByIds(ids);
    }

    /**
     * 删除设备物料种类信息
     *
     * @param id 设备物料种类主键
     * @return 结果
     */
    @Override
    public int deleteDeviceMaterialsTypeById(Long id)
    {
        return deviceMaterialsTypeMapper.deleteDeviceMaterialsTypeById(id);
    }
}
