package com.hw.dms.service.impl;

import java.util.List;
import com.hw.common.core.utils.DateUtils;
import com.hw.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.dms.mapper.DmsBaseDeviceInstallMapper;
import com.hw.dms.domain.DmsBaseDeviceInstall;
import com.hw.dms.service.IDmsBaseDeviceInstallService;

/**
 * 设备安装信息Service业务层处理
 *
 * @author xins
 * @date 2024-01-02
 */
@Service
public class DmsBaseDeviceInstallServiceImpl implements IDmsBaseDeviceInstallService
{
    @Autowired
    private DmsBaseDeviceInstallMapper dmsBaseDeviceInstallMapper;

    /**
     * 查询设备安装信息
     *
     * @param deviceInstallId 设备安装信息主键
     * @return 设备安装信息
     */
    @Override
    public DmsBaseDeviceInstall selectDmsBaseDeviceInstallByDeviceInstallId(Long deviceInstallId)
    {
        return dmsBaseDeviceInstallMapper.selectDmsBaseDeviceInstallByDeviceInstallId(deviceInstallId);
    }

    /**
     * 查询设备安装信息列表
     *
     * @param dmsBaseDeviceInstall 设备安装信息
     * @return 设备安装信息
     */
    @Override
    public List<DmsBaseDeviceInstall> selectDmsBaseDeviceInstallList(DmsBaseDeviceInstall dmsBaseDeviceInstall)
    {
        return dmsBaseDeviceInstallMapper.selectDmsBaseDeviceInstallList(dmsBaseDeviceInstall);
    }

    /**
     * 新增设备安装信息
     *
     * @param dmsBaseDeviceInstall 设备安装信息
     * @return 结果
     */
    @Override
    public int insertDmsBaseDeviceInstall(DmsBaseDeviceInstall dmsBaseDeviceInstall)
    {

        LoginUser loginUser = new LoginUser();
        dmsBaseDeviceInstall.setCreateBy(loginUser.getUsername());
        dmsBaseDeviceInstall.setCreateTime(DateUtils.getNowDate());
        return dmsBaseDeviceInstallMapper.insertDmsBaseDeviceInstall(dmsBaseDeviceInstall);
    }

    /**
     * 修改设备安装信息
     *
     * @param dmsBaseDeviceInstall 设备安装信息
     * @return 结果
     */
    @Override
    public int updateDmsBaseDeviceInstall(DmsBaseDeviceInstall dmsBaseDeviceInstall)
    {

        LoginUser loginUser = new LoginUser();
        dmsBaseDeviceInstall.setUpdateBy(loginUser.getUsername());
        dmsBaseDeviceInstall.setUpdateTime(DateUtils.getNowDate());
        return dmsBaseDeviceInstallMapper.updateDmsBaseDeviceInstall(dmsBaseDeviceInstall);
    }

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

    /**
     * 删除设备安装信息信息
     *
     * @param deviceInstallId 设备安装信息主键
     * @return 结果
     */
    @Override
    public int deleteDmsBaseDeviceInstallByDeviceInstallId(Long deviceInstallId)
    {
        return dmsBaseDeviceInstallMapper.deleteDmsBaseDeviceInstallByDeviceInstallId(deviceInstallId);
    }
}
