package com.hw.dms.service.impl;

import java.util.List;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.dms.mapper.DmsBaseDeviceParamMapper;
import com.hw.dms.domain.DmsBaseDeviceParam;
import com.hw.dms.service.IDmsBaseDeviceParamService;

/**
 * 设备参数信息Service业务层处理
 *
 * @author xins
 * @date 2024-01-09
 */
@Service
public class DmsBaseDeviceParamServiceImpl implements IDmsBaseDeviceParamService
{
    @Autowired
    private DmsBaseDeviceParamMapper dmsBaseDeviceParamMapper;

    /**
     * 查询设备参数信息
     *
     * @param deviceParamId 设备参数信息主键
     * @return 设备参数信息
     */
    @Override
    public DmsBaseDeviceParam selectDmsBaseDeviceParamByDeviceParamId(Long deviceParamId)
    {
        return dmsBaseDeviceParamMapper.selectDmsBaseDeviceParamByDeviceParamId(deviceParamId);
    }

    /**
     * 查询设备参数信息列表
     *
     * @param dmsBaseDeviceParam 设备参数信息
     * @return 设备参数信息
     */
    @Override
    public List<DmsBaseDeviceParam> selectDmsBaseDeviceParamList(DmsBaseDeviceParam dmsBaseDeviceParam)
    {
        return dmsBaseDeviceParamMapper.selectDmsBaseDeviceParamList(dmsBaseDeviceParam);
    }

    /**
     * 新增设备参数信息
     *
     * @param dmsBaseDeviceParam 设备参数信息
     * @return 结果
     */
    @Override
    public int insertDmsBaseDeviceParam(DmsBaseDeviceParam dmsBaseDeviceParam)
    {
        LoginUser user = SecurityUtils.getLoginUser();
        dmsBaseDeviceParam.setCreateBy(user.getUsername());
        dmsBaseDeviceParam.setIsFlag(1l);
        dmsBaseDeviceParam.setCreateTime(DateUtils.getNowDate());
        return dmsBaseDeviceParamMapper.insertDmsBaseDeviceParam(dmsBaseDeviceParam);
    }

    /**
     * 修改设备参数信息
     *
     * @param dmsBaseDeviceParam 设备参数信息
     * @return 结果
     */
    @Override
    public int updateDmsBaseDeviceParam(DmsBaseDeviceParam dmsBaseDeviceParam)
    {
        LoginUser user = SecurityUtils.getLoginUser();
        dmsBaseDeviceParam.setUpdateBy(user.getUsername());
        dmsBaseDeviceParam.setIsFlag(1l);
        dmsBaseDeviceParam.setUpdateTime(DateUtils.getNowDate());
        return dmsBaseDeviceParamMapper.updateDmsBaseDeviceParam(dmsBaseDeviceParam);
    }

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

    /**
     * 删除设备参数信息信息
     *
     * @param deviceParamId 设备参数信息主键
     * @return 结果
     */
    @Override
    public int deleteDmsBaseDeviceParamByDeviceParamId(Long deviceParamId)
    {
        return dmsBaseDeviceParamMapper.deleteDmsBaseDeviceParamByDeviceParamId(deviceParamId);
    }
}
