package org.dromara.ems.base.service.impl;

import org.dromara.common.core.utils.DateUtils;
import org.dromara.ems.base.domain.EmsBaseCollectDeviceInfo;
import org.dromara.ems.base.mapper.EmsBaseCollectDeviceInfoMapper;
import org.dromara.ems.base.service.IEmsBaseCollectDeviceInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 采集设备信息Service业务层处理
 *
 * @author Yinq
 * @date 2024-05-20
 */
@Service
@RequiredArgsConstructor
public class EmsBaseCollectDeviceInfoServiceImpl implements IEmsBaseCollectDeviceInfoService {
    
    private final EmsBaseCollectDeviceInfoMapper emsBaseCollectDeviceInfoMapper;

    /**
     * 查询采集设备信息
     *
     * @param objId 采集设备信息主键
     * @return 采集设备信息
     */
    @Override
    public EmsBaseCollectDeviceInfo selectEmsBaseCollectDeviceInfoByObjId(Long objId) {
        return emsBaseCollectDeviceInfoMapper.selectEmsBaseCollectDeviceInfoByObjId(objId);
    }

    /**
     * 查询采集设备信息列表
     *
     * @param emsBaseCollectDeviceInfo 采集设备信息
     * @return 采集设备信息
     */
    @Override
    public List<EmsBaseCollectDeviceInfo> selectEmsBaseCollectDeviceInfoList(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo) {
        return emsBaseCollectDeviceInfoMapper.selectEmsBaseCollectDeviceInfoList(emsBaseCollectDeviceInfo);
    }

    /**
     * 新增采集设备信息
     *
     * @param emsBaseCollectDeviceInfo 采集设备信息
     * @return 结果
     */
    @Override
    public int insertEmsBaseCollectDeviceInfo(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo) {
        emsBaseCollectDeviceInfo.setCreateTime(DateUtils.getNowDate());
        return emsBaseCollectDeviceInfoMapper.insertEmsBaseCollectDeviceInfo(emsBaseCollectDeviceInfo);
    }

    /**
     * 修改采集设备信息
     *
     * @param emsBaseCollectDeviceInfo 采集设备信息
     * @return 结果
     */
    @Override
    public int updateEmsBaseCollectDeviceInfo(EmsBaseCollectDeviceInfo emsBaseCollectDeviceInfo) {
        emsBaseCollectDeviceInfo.setUpdateTime(DateUtils.getNowDate());
        return emsBaseCollectDeviceInfoMapper.updateEmsBaseCollectDeviceInfo(emsBaseCollectDeviceInfo);
    }

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

    /**
     * 删除采集设备信息信息
     *
     * @param objId 采集设备信息主键
     * @return 结果
     */
    @Override
    public int deleteEmsBaseCollectDeviceInfoByObjId(Long objId) {
        return emsBaseCollectDeviceInfoMapper.deleteEmsBaseCollectDeviceInfoByObjId(objId);
    }
}
